From 233a5cc2e960f7eb84dd59f660e2eac039582f44 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 9 Oct 2026 14:57:53 +0200 Subject: [PATCH] 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. --- kde/gui/ChatPane.qml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/kde/gui/ChatPane.qml b/kde/gui/ChatPane.qml index a4b2072..37503da 100644 --- a/kde/gui/ChatPane.qml +++ b/kde/gui/ChatPane.qml @@ -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)