Warning: session_start(): open(/var/lib/php/sessions/sess_mcj3ehq3f7ai5upcucs11020dc, 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 TrainableBot > DynSockPuppetConvo {
delegate Post to JChatConvo.
LS suggestions;
S functions;
transient SingleComponentPanel scpSuggestions;
transient FunctionsLoader loader;
transient Thread playThread;
start {
onPostAdded.add(post -> startPlaying());
}
visual jvsplit(super,
withMargin(jhsplit(
jCenteredSection("Suggestions", scpSuggestions = singleComponentPanel(renderSuggestions())),
northAndCenterWithMargin(
jrightaligned(jbutton("Load", rThreadEnter loadFunctions)),
dm_textAreaAsSection functions()))));
JComponent renderSuggestions() {
ret ele_renderSuggestions(null, suggestions,
sayAction := (IVF1) s -> addPost(s, true),
submitAction := (IVF1) s -> addPost(s, false));
}
void showSuggestions(Cl suggestions) {
setField(suggestions := asList(suggestions));
showSuggestions();
}
void showSuggestions {
scpSuggestions?.setComponent(renderSuggestions());
}
void loadFunctions {
dispose loader;
loader = new FunctionsLoader(tlftj(functions));
loader.onLoaded(r startPlaying);
loader.loadInBackground();
}
void startPlaying enter {
if (loader == null) loadFunctions();
cancelThread(playThread);
playThread = null;
playThread = startThread(rEnter play);
}
void play {
//showSuggestions(ll("test " + now()));
new LinkedHashSet l;
S input = lastInput();
for ping (S f : loader.functions) {
addIfInstanceOf(l, S, callBlobFunction(f));
ping();
if (nempty(input))
addIfInstanceOf(l, S, callBlobFunction(f, input));
}
showSuggestions(l);
}
O callBlobFunction(S fname, O... args) {
if (canCallWithVarargs(module(), fname, args))
ret callWithVarargs(module(), fname ,args);
else
ret callOpt(loader.blob, fname, args);
}
LPairS userBotPairs() {
new LPairS out;
for (Pair p : overlappingPairs(posts))
if (!p.a.right && p.b.right)
out.add(pair(p.a.html, p.b.html));
ret out;
}
}