Load chat history when chat pane starts

This commit is contained in:
Levi Neely 2026-08-16 12:59:36 +02:00
parent 541ef48bb7
commit 8103d80df2
1 changed files with 19 additions and 9 deletions

View File

@ -6,6 +6,15 @@ Item {
id: chatPane
property bool sidebarVisible: true
signal toggleSidebar()
function loadChat() {
chatModel.reset()
if (ollie.activeSessionId && ollie.activeAgentId) {
var log = ollie.readLogForSession(ollie.activeSessionId, ollie.activeAgentId)
if (log) { chatModel.appendData(log); chatModel.trimFront(20) }
}
}
Component.onCompleted: loadChat()
ColumnLayout {
anchors.fill: parent
@ -254,15 +263,16 @@ Item {
Connections {
target: ollie
function loadChat() {
chatModel.reset()
if (ollie.activeSessionId && ollie.activeAgentId) {
var log = ollie.readLogForSession(ollie.activeSessionId, ollie.activeAgentId)
if (log) { chatModel.appendData(log); chatModel.trimFront(20) }
}
}
function onActiveSessionIdChanged() { loadChat() }
function onActiveAgentIdChanged() { loadChat() }
function onSessionsChanged() { chatPane.loadChat() }
function onActiveSessionIdChanged() { chatPane.loadChat() }
function onActiveAgentIdChanged() { chatPane.loadChat() }
}
Timer {
interval: 0
repeat: false
running: true
onTriggered: chatPane.loadChat()
}
}