Skip to content

Commit 4d79c29

Browse files
committed
SimpleChatTC:Show: Cleanup
Update existing flow so that next Tool Role message is handled directly from within
1 parent 65abb70 commit 4d79c29

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tools/server/public_simplechat/simplechat.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class SimpleChat {
367367
if (iRecentUserMsgCnt == 0) {
368368
console.warn("WARN:SimpleChat:SC:RecentChat:iRecentUsermsgCnt of 0 means no user message/query sent");
369369
}
370-
/** @type{ChatMessages} */
370+
/** @type {ChatMessages} */
371371
let rchat = [];
372372
let sysMsg = this.get_system_latest();
373373
if (sysMsg.ns.content.length != 0) {
@@ -493,16 +493,16 @@ class SimpleChat {
493493
div.replaceChildren();
494494
}
495495
let last = undefined;
496-
for(const x of this.recent_chat(gMe.chatProps.iRecentUserMsgCnt)) {
497-
if (x.ns.role != Roles.ToolTemp) {
498-
let entry = ui.el_create_append_p(`${x.ns.role}: ${x.content_equiv()}`, div);
499-
entry.className = `role-${x.ns.role}`;
500-
last = entry;
501-
} else {
502-
if (elInUser) {
496+
for(const [i, x] of this.recent_chat(gMe.chatProps.iRecentUserMsgCnt).entries()) {
497+
if (x.ns.role === Roles.ToolTemp) {
498+
if (i == (this.xchat.length - 1)) {
503499
elInUser.value = x.ns.content;
504500
}
501+
continue
505502
}
503+
let entry = ui.el_create_append_p(`${x.ns.role}: ${x.content_equiv()}`, div);
504+
entry.className = `role-${x.ns.role}`;
505+
last = entry;
506506
}
507507
if (last !== undefined) {
508508
last.scrollIntoView(false);

0 commit comments

Comments
 (0)