SimpleChatTCRV:Cleanup: Efficient ChatMessage Ui Delete
avoid refreshing the full chat session messages ui also Update readme
This commit is contained in:
parent
95f79eb8b0
commit
f3424d3a2a
|
|
@ -779,9 +779,6 @@ same when saved chat is loaded.
|
|||
|
||||
MAYBE make the settings in general chat session specific, rather than the current global config flow.
|
||||
|
||||
Have unique id or use the index into chat messages array wrt each chat message in a chat session, so that
|
||||
it is easy to identify and remove chat messages from the UI even in sliding window mode.
|
||||
|
||||
Have a seperate helper to show the user input area, based on set state. And have support for multiple images
|
||||
if the models support same.
|
||||
|
||||
|
|
|
|||
|
|
@ -1346,6 +1346,19 @@ class MultiChatUI {
|
|||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified ChatMessage block in ui, without needing to show full chat session again.
|
||||
* @param {number} uniqIdChatMsg
|
||||
*/
|
||||
ui_chatmessage_delete(uniqIdChatMsg) {
|
||||
let index = this.simpleChats[this.curChatId].delete(uniqIdChatMsg)
|
||||
if (index >= 0) {
|
||||
let el = document.querySelector(`[CMUniqId="${uniqIdChatMsg}"`)
|
||||
console.log(el)
|
||||
el?.remove()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the needed callbacks wrt UI, curChatId to defaultChatId and
|
||||
* optionally switch to specified defaultChatId.
|
||||
|
|
@ -1442,15 +1455,7 @@ class MultiChatUI {
|
|||
|
||||
this.elPopoverChatMsgDelBtn.addEventListener('click', (ev) => {
|
||||
console.log(`DBUG:MCUI:ChatMsgPO:Del:${this.curChatId}:${this.uniqIdChatMsgPO}`)
|
||||
let index = this.simpleChats[this.curChatId].delete(this.uniqIdChatMsgPO)
|
||||
if (index >= 0) {
|
||||
this.chat_show(this.curChatId)
|
||||
let msg = this.simpleChats[this.curChatId].xchat[index]
|
||||
if (msg) {
|
||||
let el = document.querySelector(`[CMUniqId="${msg.uniqId}"`)
|
||||
this.scroll_el_into_view(el)
|
||||
}
|
||||
}
|
||||
this.ui_chatmessage_delete(this.uniqIdChatMsgPO)
|
||||
})
|
||||
|
||||
this.elPopoverChatMsgCopyBtn.addEventListener('click', (ev) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue