Warning: session_start(): open(/var/lib/php/sessions/sess_ihg4jq6fjpdechlncpifap6m43, 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
srecord Line (
S type, // 'user, 'suggestion, 'bot, 'metaComment
S text
) {}
concept Interaction {
new L lines;
bool current;
void addLine(Line line) {
lines.add(line);
change();
}
}
sS lineToString(Line line) {
ret lpad(10, firstToUpper(replaceCompleteValue(line.type, 'metaComment, 'comment))) + ": " + line.text;
}
module TrainInteraction {
transient S imageID = #1101205;
transient JTextArea taInteraction;
transient S log;
transient JTextField tfInput, tfToSay, tfMeta;
transient JLabel lblOutput;
transient Interaction current;
start {
db();
current = uniq_sync(Interaction, current := true);
log = lines(map lineToString(current.lines));
}
visualize {
onEnter(tfInput = jTextField(), r {
addLine(Line('user, gtt(tfInput)))
});
onEnter(tfToSay = jTextField(), r {
addLine(Line('suggestion, gtt(tfToSay)))
});
onEnter(tfMeta = jTextField(), r {
addLine(Line('metaComment, gtt(tfMeta)))
});
taInteraction = dm_fieldTextArea('log);
ret withRightAlignedButtons(
centerAndSouthWithMargins(
westAndCenterWithMargin(jimage(imageID), taInteraction),
northAndCenterWithMargin(
fontSize(20, lblOutput = jCenteredBoldLabel(" ")),
makeForm3(
"Your input:", focusOnShow(fontSize(16, tfInput)),
"Make me say:", fontSize(16, tfToSay),
"Make a meta-comment:", fontSize(16, tfMeta))
)),
"Start Over", rThread {
if (empty(current.lines) || confirmOKCancel("Sure?")) {
cset(current, lines := new L);
setField(log := "");
}
},
"Save Interaction", rThread {
dm_call(dm_makeOrShowModule("#1020418/TrainedInteractions"), 'addInteraction, current);
cset(current, current := false);
current = uniq_sync(Interaction, current := true);
setField(log := "");
});
}
Line addLine(Line line) {
current.addLine(line);
setField(log := log + lineToString(line) + "\n");
ret line;
}
}