Warning: session_start(): open(/var/lib/php/sessions/sess_17h9gl4a39jq4pj135tgeain7n, 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
static new L thoughtBots;
// allows skipping patterns when they don't apply
concept Learner {
S pattern;
SS examples = mapInConcept(this, litorderedmap()); // maps to 'assumed, 'confirmed or 'rejected
}
p {
long time = sysNow();
db();
autoRestart();
serveHttp(4678);
typicalDownload();
bot("Smart Bot.");
loadPage_forcedTimeout = 70000;
loadBots(#1010753, #1010821, #1010825);
thoughtBots.add(mc());
stefansChat_onLine_lookback = 2;
stefansChat_onLine_safe(voidfunc(S text) {
print("> " + text);
S answer = scanMultipleBots(thoughtBots, text);
if (nempty(answer))
postToStefansChat(answer);
});
stefansChat_post("Smart Bot Upgraded! Boot took: " + formatDouble(fromMS(sysNow()-time), 1) + " s");
runInNewThread(#1010793); // Post on UAIP
}
answer {
s = trim(s);
if (eqic(s, "!restart")) { restart(); ret "Yo"; }
if "Are you online?" ret "Yes";
if (eqic(s, "!question"))
ret random_gac36k();
if "give me subtypes of ..."
ret ai_renderList(ai_subtypesOf(m.rest()));
if "show me the ..."
ret "What " + $1 + "?";
if (flexMatch("What do * have?", s, m))
ret ai_renderNodesList(webs_search_dollarX(webFromTriples($1, "have", "$X"), indexedWebs($1)));
if "What is ..."
ret ai_renderNodesList(webs_search_dollarX(webFromTriples($1, "is", "$X"), indexedWebs($1)), "I don't know");
S match;
if (learnedFlexMatch(match = "* is *", s, m)) {
postSoftwareMadeWeb(webFromTriples($1, "is", $3),
+match, input := s);
ret "OK, stored.";
}
}
svoid loadBots(S... botIDs) {
for (S id : botIDs) pcall {
thoughtBots.add(runSubBot(id));
}
}
sbool learnedFlexMatch(S pattern, S s, Matches m) {
if (!flexMatch(pattern, s, m)) false;
Learner l = uniq(Learner, +pattern);
S status = l.examples.get(s);
if (eq(status, 'rejected)) false;
if (empty(status))
l.examples.put(status, 'assumed);
true;
}
html {
ret serveText_direct(printLog());
}