Warning: session_start(): open(/var/lib/php/sessions/sess_vdokgng912233r5e59cd7mg39a, 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);
bool authed = isTrue(stefansChat_onLine_fullParams->get('auth));
if (authed) {
if (eqic(s, "!restart")) { restart(); ret "Yo"; }
if "unlearn * *"
ret "OK, was: " + uniq(Learner, $1).examples.put($2, 'rejected);
}
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 "authed?"
ret authed ? "You are authed." : "You are not authed.";
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 (learnedFlexMatch("What is *", s, m))
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(s, 'assumed);
true;
}
// s = uri
static NanoHTTPD.Response html(S s) {
if "log"
ret serveText_direct(printLog());
ret serveText_direct(renderConcepts(list(Learner)));
}