!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.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(result);"; S speechUI = hdiv( "< Talk to me >", id := 'speechResults, style := "margin: 10px") + p(tag("button", "...", onclick := "startOrStop()", type := 'button, id := 'speechOnBtn, disabled := 'disabled)); ret hhtml(hmobilefix() + hhead( htitle("CRUDDIE") + hLoadJQuery2()) + hbody(hfullcenter( p(hsnippetimage(#1102905)) + p("Chat bot coming up.") + p("Server temperature is " + dm_cpuTemperature()) + hSpeechRecognition(jsOnSpeech, true, "en-US", false, noWebKit := p("Use Chrome if you want speech recognition"), +speechUI) + hscript_src(botLink()) ))); } }