!7 cmodule TrainableBot > DynSockPuppetConvo { LS suggestions; S functions; transient SingleComponentPanel scpSuggestions; transient FunctionsLoader loader; transient Thread playThread; visual jvsplit(super, 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 { cancelThread(playThread); playThread = null; playThread = startThread(rEnter play); } void play { //showSuggestions(ll("test " + now())); new LinkedHashSet l; S input = lastInput(); for (S f : loader.functions) { addIfInstanceOf(l, S, pcallOpt(loader.blob, f)); if (nempty(input)) addIfInstanceOf(l, S, pcallOpt(loader.blob, f, input)); } showSuggestions(l); } }