SimpleChatTCRV:UICleanup: User Input area one bunch of clenaup
ui_reset_userinput now resets role associated with user input to user always. chat_show now does a full on ui_reset_userinput, and thus inturn session switching now force cleans up User Input area, state and associated data (like dataURLs) with chat_show->ui_reset_userinput. UIRefresh helper does a partial ui_reset_userinput thus cleaning up the user input state. Inturn given that addsmart_uishow calls uirefresh, so avoid calling partial ui_reset_userinput after call to addsmart_uishow. show_message now sets user input area role to either ToolTemp or User (all cases other than ToolTemp).
This commit is contained in:
parent
735a8b382c
commit
a49774817b
|
|
@ -788,6 +788,11 @@ Cleanup in general
|
|||
had to account for delayed collating of available simpleproxy based tool calls, I forgot to clean
|
||||
this flow up.
|
||||
* Make the sys_date_time template description bit more verbose, just in case.
|
||||
* ui_reset_userinput now also resets associated Role always, inturn
|
||||
* full on version from chat_show, inturn when session switching.
|
||||
So user switchs session will reset all user input area and related data, while
|
||||
also ensuring user input area has the right needed associated role setup.
|
||||
* partial version from uirefresh, inturn adding user or tool call response messages.
|
||||
|
||||
|
||||
|
||||
|
|
@ -820,6 +825,9 @@ implemented, need to cross check.
|
|||
Should I force a chat_show which clears usage and current settings info from chat session ui block at the
|
||||
begining like before the new optimised uirefresh based flow?
|
||||
|
||||
Updating system prompt, will reset user input area fully now, which seems a good enough behaviour, while
|
||||
keeping the code flow also simple and straight, do I need to change it, I dont think so as of now.
|
||||
|
||||
|
||||
### Debuging the handshake and beyond
|
||||
|
||||
|
|
|
|||
|
|
@ -1186,6 +1186,7 @@ class MultiChatUI {
|
|||
* Reset user input ui.
|
||||
* * clear user input (if requested, default true)
|
||||
* * enable user input
|
||||
* * set to Roles.User
|
||||
* * set focus to user input
|
||||
* @param {boolean} [bClearElInUser=true]
|
||||
*/
|
||||
|
|
@ -1194,6 +1195,7 @@ class MultiChatUI {
|
|||
this.elInUser.value = "";
|
||||
this.dataurl_plus_clear()
|
||||
}
|
||||
this.elInUser.dataset.role = Roles.User;
|
||||
this.elInUser.disabled = false;
|
||||
this.elInUser.focus();
|
||||
}
|
||||
|
|
@ -1245,9 +1247,7 @@ class MultiChatUI {
|
|||
} else {
|
||||
this.elInUser.value = "";
|
||||
}
|
||||
// Rather maybe set this to between either ToolTemp or User
|
||||
// and not any and every possible role.
|
||||
this.elInUser.dataset.role = msg.ns.role
|
||||
this.elInUser.dataset.role = (msg.ns.role == Roles.ToolTemp) ? Roles.ToolTemp : Roles.User
|
||||
}
|
||||
// Create main section
|
||||
let secMain = document.createElement('section')
|
||||
|
|
@ -1352,6 +1352,7 @@ class MultiChatUI {
|
|||
let chat = this.simpleChats[this.curChatId];
|
||||
if (bClear) {
|
||||
this.elDivChat.replaceChildren();
|
||||
this.ui_reset_userinput()
|
||||
}
|
||||
this.ui_reset_toolcall_as_needed(new ChatMessageEx());
|
||||
this.elLastChatMessage = null
|
||||
|
|
@ -1410,6 +1411,7 @@ class MultiChatUI {
|
|||
if (chat.chatId != this.curChatId) {
|
||||
return false
|
||||
}
|
||||
this.ui_reset_userinput(false)
|
||||
this.ui_reset_toolcall_as_needed(new ChatMessageEx());
|
||||
for(let i=lastN; i > 0; i-=1) {
|
||||
let msg = chat.xchat[chat.xchat.length-i]
|
||||
|
|
@ -1524,7 +1526,6 @@ class MultiChatUI {
|
|||
}, this.me.tools.autoSecs*this.TimePeriods.ToolCallAutoSecsTimeUnit)
|
||||
}
|
||||
}
|
||||
this.ui_reset_userinput(false)
|
||||
})
|
||||
|
||||
this.elInUser.addEventListener("keyup", (ev)=> {
|
||||
|
|
@ -1682,12 +1683,10 @@ class MultiChatUI {
|
|||
let toolResult = await chat.handle_toolcall(toolCallId, toolname, this.elInToolArgs.value)
|
||||
if (toolResult !== undefined) {
|
||||
this.chatmsg_addsmart_uishow(chat.chatId, new ChatMessageEx(NSChatMessage.new_tool_response(Roles.ToolTemp, toolCallId, toolname, toolResult)))
|
||||
this.ui_reset_userinput(false)
|
||||
} else {
|
||||
this.timers.toolcallResponseTimeout = setTimeout(() => {
|
||||
this.me.toolsMgr.toolcallpending_found_cleared(chat.chatId, toolCallId, 'MCUI:HandleToolRun:TimeOut')
|
||||
this.chatmsg_addsmart_uishow(chat.chatId, new ChatMessageEx(NSChatMessage.new_tool_response(Roles.ToolTemp, toolCallId, toolname, `Tool/Function call ${toolname} taking too much time, aborting...`)))
|
||||
this.ui_reset_userinput(false)
|
||||
}, this.me.tools.toolCallResponseTimeoutMS)
|
||||
}
|
||||
}
|
||||
|
|
@ -1766,7 +1765,6 @@ class MultiChatUI {
|
|||
return;
|
||||
}
|
||||
this.elInSystem.value = chat.get_system_latest().ns.getContent();
|
||||
this.elInUser.value = "";
|
||||
this.curChatId = chatId;
|
||||
this.chat_show(chatId, true, true);
|
||||
this.elInUser.focus();
|
||||
|
|
|
|||
Loading…
Reference in New Issue