Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/KEYS.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Back returns to the previous screen with the draft intact.

While an AI request is running, Escape interrupts it and keeps the dock open; otherwise Escape closes the dock. An open command suggestion or history view is left first.

The AI input uses `assistant`: Return/Enter sends and Shift+Return/Enter inserts a newline. Ctrl+Return/Enter also sends for compatibility. Typing `/` offers `/clear` (new chat), `/history` (conversation history), and `/diagnose` (diagnostics). Up/Down selects a suggestion; Return/Enter completes a partial command or executes an exact command immediately. Commands stay local. Outside suggestions, Up/Down retain normal text navigation.
The AI input uses `assistant`: Return/Enter sends and Shift+Return/Enter inserts a newline. Ctrl+Return/Enter also sends for compatibility. Typing `/` offers `/clear` (new chat), `/history` (conversation history), and `/diagnose` (diagnostics). Up/Down selects a suggestion; Return/Enter completes a partial command or executes an exact command immediately; choosing `/history` always opens the history at once. Commands stay local. Outside suggestions, Up/Down retain normal text navigation.

Changing the AI agent or model starts fresh chats and clears queued follow-ups while preserving unsent input. Previous chats remain readable in History, but cannot continue across the selection change; the cutoff persists across restarts. New chats created afterward can still resume normally.

Expand Down
2 changes: 1 addition & 1 deletion ui/App.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ Item {
if (eventComposer.guestSuggestionsOpen) { eventComposer.dismissGuestSuggestions(); return }
if (calendarView.dismissPreview()) return
if (activeAssistant && activeAssistant.commandsOpen) { activeAssistant.dismissCommands(); return }
if (activeAssistant && activeAssistant.historyMode) { activeAssistant.historyMode = false; activeAssistant.takeFocus(); return }
if (activeAssistant && activeAssistant.historyMode) { activeAssistant.leaveHistory(); return }
if (activeAssistant && activeAssistant.interrupt()) return
if (composeAgent.opened) { composeAgent.close(); return }
if (agentPrompt.opened) { agentPrompt.close(); return }
Expand Down
26 changes: 22 additions & 4 deletions ui/components/AgentPrompt.qml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ FocusScope {
return defaultJob && selectionOwns(defaultJob) && String(defaultJob.id) !== ignoredJobId ? defaultJob : null
}
function showHistory() { historyMode = true; historyList.currentIndex = historyJobs.length ? 0 : -1; historyList.forceActiveFocus() }
function leaveHistory() { historyMode = false; takeFocus() }
function selectHistory(id) {
viewedJobId = String(id)
viewedConversationId = ""
Expand Down Expand Up @@ -248,7 +249,11 @@ FocusScope {
function chooseCommand(index) {
if (!commandsOpen) return false
var command = commandMatches[typeof index === "number" ? index : commandIndex]
if (field.text.trim() === command) return submitCurrent()
// History takes no argument, so choosing it opens the list at once.
if (field.text.trim() === command || command === "/history") {
field.text = command
return submitCurrent()
}
field.text = command + " "
dismissedCommandText = field.text
field.cursorPosition = field.length
Expand Down Expand Up @@ -402,13 +407,26 @@ FocusScope {
anchors.margins: Style.space(12)
spacing: Style.space(8)
Row {
id: header
width: parent.width
spacing: Style.space(8)
BackBar {
id: historyBack
objectName: "agent-history-back"
visible: root.historyMode
anchors.verticalCenter: parent.verticalCenter
label: "Chat"
textColor: root.textColor
dimColor: root.dimColor
panelFontFamily: root.panelFontFamily
onActivated: root.leaveHistory()
}
Text {
width: parent.width
width: parent.width - (historyBack.visible ? historyBack.width + parent.spacing : 0)
anchors.verticalCenter: parent.verticalCenter
textFormat: Text.PlainText
text: root.composer ? "AI · " + (root.fields.subject || "Draft")
text: root.historyMode ? "AI · History"
: root.composer ? "AI · " + (root.fields.subject || "Draft")
: "AI · " + (root.subject || "Message")
color: root.textColor
font.family: root.panelFontFamily
Expand Down Expand Up @@ -832,7 +850,7 @@ FocusScope {
objectName: "agent-history"
visible: root.historyMode
anchors.fill: content
anchors.topMargin: Style.space(28)
anchors.topMargin: header.height + content.spacing
clip: true
model: root.historyJobs
keyNavigationEnabled: true
Expand Down
17 changes: 15 additions & 2 deletions ui/tests/qml/tst_agent_interaction.qml
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,24 @@ Item {
field.text = "/"
popup.moveCommand(1)
verify(popup.chooseCommand())
compare(field.text, "/history ")
verify(popup.submitCurrent())
compare(field.text, "")
compare(popup.historyMode, true)
compare(service.calls, 0)
}
function test_history_back_returns_to_chat() {
popup.openCenteredFor("m1", "Mail")
var back = findChild(popup, "agent-history-back")
compare(back.visible, false)
popup.showHistory()
verify(waitForRendering(popup))
compare(back.visible, true)
var list = findChild(popup, "agent-history")
verify(list.mapToItem(popup, 0, 0).y >= back.mapToItem(popup, 0, back.height).y, "history list sits below the back button")
mouseClick(back)
compare(popup.historyMode, false)
compare(back.visible, false)
verify(findChild(popup, "agent-prompt-field").activeFocus)
}
function test_restart_keeps_unsent_input() {
service.jobs=[{id:"ended",messageId:"m1",accountId:service.activeAccountId,state:"failed",canContinue:false}]
popup.openCenteredFor("m1", "Mail")
Expand Down
Loading