Warning: session_start(): open(/var/lib/php/sessions/sess_k0ka3a03oqegl8kr8s0o06s05e, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
cmodule Cruddie > DynPrintLogAndEnabled {
!include #1027628 // HTTP+HTTPS servers
transient S salt;
transient WebChatBot chatBot;
S myLink() { ret "https://cruddie.site/"; }
S botLink() { ret "bot"; /*ret appendWithSlash(myLink(), "bot");*/ }
S frontendModuleLibID = "#1027602/ChatBotFrontend";
S backendModuleLibID = "#1027591/DynamicClassesMultiCRUD";
transient S cmdsSnippetID = #1027616;
start-thread {
File saltFile = secretProgramFile("salt.txt");
S salt = trimLoadTextFile(saltFile);
if (empty(salt)) {
saveTextFile(saltFile, salt = randomID());
print("Made salt");
}
dm_restartOnFieldChange enabled();
if (!enabled) ret;
S speechUI =
hspan( // hdiv
"< Talk to me >",
id := 'speechResults,
display := "inline") + " "
+ tag("button", "...", onclick := "startOrStop()", type := 'button, id := 'speechOnBtn, disabled := 'disabled, display := 'inline);
chatBot = new WebChatBot;
chatBot.baseLink = botLink();
chatBot.thoughtBot = new ThoughtBot;
chatBot.jsOnMsgHTML = "window.processNewStuff(src);";
chatBot.afterHeading =
//noWebKit := "[" + targetBlank("http://www.google.com/chrome", "Use Chrome") + " if you want speech recognition]",
speechUI;
chatBot.templateHTML = () ->
chatBot.templateHTML_base().replace("//MORESTUFF//", "window.startSpeechRecog();");
chatBot.start();
set redirectHttpToHttps;
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 = "if (transcript != 'stop listening') 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
console.log("Got speech");
var match = src.match(/\d+/);
if (match == null) return;
if (src.match(/NEW DIALOG -->/)) return;
console.log("Got incremental");
var re = /bot-utterance">(.*?) request;
void setSession(S cookie, SS params) {
//session.set(uniq_sync(Session, +cookie));
request.set(new Request(cookie));
}
S initialMessage() {
//ret "Hello from module " + request->backend;
ret (S) dm_call(request->backend, 'answer, "stats");
}
S answer(S s) {
ret (S) dm_call(request->frontend, 'answer, s);
}
}
}