SimpleChatTC: Cleanup initial/1st go toolcall flow
As output generated by any tool/function call is currently placed into the TextArea provided for End user (for their queries), bcas the GenAi (engine/LLM) may be expecting the tool response to be sent as a user role data with tool_response tag surrounding the results from the tool call. So also now at the end of submit btn click handling, the end user input text area is not cleared, if there was a tool call handled, for above reasons. Also given that running a simple arithmatic expression in itself doesnt generate any output, so wrap them in a console.log, to help capture the result using the console.log trapping flow that is already setup.
This commit is contained in:
parent
301910c3a1
commit
17c5daa52c
|
|
@ -586,12 +586,15 @@ class MultiChatUI {
|
|||
|
||||
/**
|
||||
* Reset user input ui.
|
||||
* * clear user input
|
||||
* * clear user input (if requested, default true)
|
||||
* * enable user input
|
||||
* * set focus to user input
|
||||
* @param {boolean} [bClearElInUser=true]
|
||||
*/
|
||||
ui_reset_userinput() {
|
||||
this.elInUser.value = "";
|
||||
ui_reset_userinput(bClearElInUser=true) {
|
||||
if (bClearElInUser) {
|
||||
this.elInUser.value = "";
|
||||
}
|
||||
this.elInUser.disabled = false;
|
||||
this.elInUser.focus();
|
||||
}
|
||||
|
|
@ -718,7 +721,7 @@ class MultiChatUI {
|
|||
if (toolResult !== undefined) {
|
||||
this.elInUser.value = `<tool_response>${toolResult}</tool_response>`
|
||||
}
|
||||
this.ui_reset_userinput();
|
||||
this.ui_reset_userinput(toolResult === undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ let calc_meta = {
|
|||
*/
|
||||
function calc_run(obj) {
|
||||
console_redir()
|
||||
let func = new Function(obj["arithexpr"])
|
||||
let func = new Function(`console.log(${obj["arithexpr"]})`)
|
||||
func()
|
||||
console_revert()
|
||||
tc_switch["simple_calculator"]["result"] = gConsoleStr
|
||||
|
|
|
|||
Loading…
Reference in New Issue