!7 cmodule Cruddie > DynPrintLogAndEnabled { !include #1027628 // HTTP+HTTPS servers transient WebChatBot chatBot; S myLink() { ret "https://cruddie.site/"; } S botLink() { ret appendWithSlash(myLink(), "bot"); } start-thread { dm_restartOnFieldChange enabled(); if (!enabled) ret; chatBot = new WebChatBot; chatBot.baseLink = botLink(); chatBot.thoughtBot = new O { S initialMessage() { ret "Hello"; } S answer(S s) { ret "I hear you"; } }; chatBot.jsOnMsgHTML = "window.processNewStuff(src);"; chatBot.start(); start_webServers(javaxSecretDir("cruddie.site/keystore.p12"), "botcompany"); } O webServe(S uri, SS params) { printVars("webServe", +uri); //S cookie = serveHttp_cookieHandling(); new Matches m; if (startsWith(appendSlash(uri), "/bot/", m)) ret chatBot.html("/" + m.rest(), params); S jsOnSpeech = "window.submitAMsg(transcript);"; S sayScript = [[ window.processNewStuff = function(src) { if ($("#speechResults") == null) return; // no speech // we assume that webkit speech synthesis is present // when there is webkit speech recognition if (!bigOn) return; // not enabled print("Got speech"); var match = src.match(/\d+/); if (match == null) return; if (src.match(/NEW DIALOG -->/)) return; print("Got incremental"); var utterances = src.match(/bot-utterance">(.*?)