SimpleChatTCRV:DivStreams: Prepared for switching in middle
Missing DivStream caught. Logic ready for a distant future, where one may allow the chat session to be switched even if there is a pending ai server / tool call response. Avoids the unneeded removeChild before calling appendChild. Also found the reason why sometimes the DivStream was missing from DivChat. Rather when I switched from the transient <p> element to the persistant session specific <div> elements, I had forgotten to convert the flow fully, rather I had forgotten to replace the elP.remove() with elP.replaceChildren Also retaining that debug log wrt missing DivStream path, Just in case for now, to cross check once later, I havent missed any other path.
This commit is contained in:
parent
5a1eaf94bf
commit
d5e5d58d85
|
|
@ -467,6 +467,10 @@ The following tools/functions are currently provided by default
|
||||||
* helps ai to process stuff that it needs, without having to worry about any previous chat history
|
* helps ai to process stuff that it needs, without having to worry about any previous chat history
|
||||||
etal messing with the current data's processing.
|
etal messing with the current data's processing.
|
||||||
* helps ai to process stuff with targeted system prompts of its choosing, for the job at hand.
|
* helps ai to process stuff with targeted system prompts of its choosing, for the job at hand.
|
||||||
|
* tool calling is disabled wrt the external_ai's independent session, for now.
|
||||||
|
* it was noticed that else even the external_ai may call into more external_ai calls trying to
|
||||||
|
find answer to the same question. maybe one can enable tool calling, while explicitly disabling
|
||||||
|
external_ai tool call from within external_ai tool call or so ...
|
||||||
* Could be used by ai for example to
|
* Could be used by ai for example to
|
||||||
* summarise a large text content, where it could use the context of the text to generate a
|
* summarise a large text content, where it could use the context of the text to generate a
|
||||||
suitable system prompt for summarising things suitably
|
suitable system prompt for summarising things suitably
|
||||||
|
|
@ -854,6 +858,11 @@ Cleanup in general
|
||||||
* Use popover ui to allow user to view larger versions of loaded images as well as remove before submitting
|
* Use popover ui to allow user to view larger versions of loaded images as well as remove before submitting
|
||||||
to ai, if and when needed.
|
to ai, if and when needed.
|
||||||
* add external_ai toolcall
|
* add external_ai toolcall
|
||||||
|
* maintain chat session specific DivStream elements, so that in future, if the logic is updated to allow
|
||||||
|
switching in the middle of a pending tool call or pending ai server response, things dont mess up wrt
|
||||||
|
ui, as they will be updating their respective DivStream and switching sessions will also take care of
|
||||||
|
making the right DivStream the currently active one, so that end user can see the streamed response
|
||||||
|
as it is occuring.
|
||||||
|
|
||||||
|
|
||||||
#### ToDo
|
#### ToDo
|
||||||
|
|
|
||||||
|
|
@ -919,7 +919,7 @@ class SimpleChat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
elP.remove()
|
elP.replaceChildren()
|
||||||
}
|
}
|
||||||
console.debug("DBUG:SC:PART:Full:", this.latestResponse.content_equiv());
|
console.debug("DBUG:SC:PART:Full:", this.latestResponse.content_equiv());
|
||||||
return ChatMessageEx.newFrom(this.latestResponse);
|
return ChatMessageEx.newFrom(this.latestResponse);
|
||||||
|
|
@ -1509,13 +1509,10 @@ class MultiChatUI {
|
||||||
this.show_message(this.elDivChat, msg, (i-1), nextMsg)
|
this.show_message(this.elDivChat, msg, (i-1), nextMsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
if (!this.elDivChat.contains(this.elDivStreams[chatId])) {
|
||||||
this.elDivChat.removeChild(this.elDivStreams[chatId])
|
console.log(`DBUG:SimpleChat:MCUI:UiRefresh:${chatId}: DivStream ${this.elDivStreams[chatId].id} missing...`)
|
||||||
} catch {
|
|
||||||
console.log(`DBUG:SimpleChat:MCUI:UiRefresh:Removing ${chatId} DivStream ${this.elDivStreams[chatId].id} failed...`)
|
|
||||||
} finally {
|
|
||||||
this.elDivChat.appendChild(this.elDivStreams[chatId])
|
|
||||||
}
|
}
|
||||||
|
this.elDivChat.appendChild(this.elDivStreams[chatId])
|
||||||
if (this.elLastChatMessage != null) {
|
if (this.elLastChatMessage != null) {
|
||||||
this.scroll_el_into_view(this.elLastChatMessage)
|
this.scroll_el_into_view(this.elLastChatMessage)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue