gui: reload full chat history when scrolling to trimmed block
When scrollToBlockId fails to find a block (trimmed from view), reload the full chat without trimming and scroll to it.
This commit is contained in:
parent
922b53de4a
commit
233a5cc2e9
|
|
@ -46,7 +46,24 @@ Item {
|
|||
var idx = chatModel.indexForBlockId(blockId)
|
||||
if (idx >= 0) {
|
||||
chatView.positionViewAtIndex(idx, ListView.Center)
|
||||
return true
|
||||
}
|
||||
// Block not in current view — reload full chat and try again
|
||||
if (ollie.activeSessionId && ollie.activeAgentId) {
|
||||
chatModel.reset()
|
||||
var log = ollie.readLogForSession(ollie.activeSessionId, ollie.activeAgentId)
|
||||
if (log) {
|
||||
chatModel.appendData(log)
|
||||
// Don't trim — keep full history so we can find the block
|
||||
idx = chatModel.indexForBlockId(blockId)
|
||||
if (idx >= 0) {
|
||||
chatView.positionViewAtIndex(idx, ListView.Center)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log("Block not found:", blockId)
|
||||
return false
|
||||
}
|
||||
function trimVisibleBlocks() {
|
||||
if (chatModel.count > chatPane.maxVisibleBlocks)
|
||||
|
|
|
|||
Loading…
Reference in New Issue