diff --git a/cmd/olliesrv/internal/agent/agent.go b/cmd/olliesrv/internal/agent/agent.go index b9bed1f..a6078f7 100644 --- a/cmd/olliesrv/internal/agent/agent.go +++ b/cmd/olliesrv/internal/agent/agent.go @@ -305,12 +305,19 @@ func (ag *Agent) Compact(ctx context.Context) error { return nil } -// Clear resets the agent history. Returns an error if the agent is running. +// Clear resets the agent history and chat log. Returns an error if the agent is running. func (ag *Agent) Clear() error { if ag.IsRunning() { return fmt.Errorf("cannot clear while agent is running") } ag.history = nil + ag.chatMu.Lock() + ag.chatLog = nil + ag.chatStart = 0 + ag.chatVers++ + ag.blockCounter = 0 + ag.chatMu.Unlock() + ag.chatCond.Broadcast() return nil } diff --git a/kde/gui/ChatPane.qml b/kde/gui/ChatPane.qml index edca030..25f6e18 100644 --- a/kde/gui/ChatPane.qml +++ b/kde/gui/ChatPane.qml @@ -381,6 +381,19 @@ Item { ToolTip.text: "Compact context window" } + ToolButton { + text: "🗑 Clear" + font.pixelSize: theme.fontSize > 0 ? theme.fontSize * 0.9 : 11 + implicitHeight: 28 + enabled: ollie.activeState === "idle" + onClicked: { + ollie.submit("/clear") + chatPane.loadChat() // Refresh the view + } + ToolTip.visible: hovered + ToolTip.text: "Clear history and start fresh" + } + ToolButton { text: "📋 Copy Last" font.pixelSize: theme.fontSize > 0 ? theme.fontSize * 0.9 : 11