aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/assistant/Assistant.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/assistant/Assistant.qml')
-rw-r--r--desktop/assistant/Assistant.qml19
1 files changed, 16 insertions, 3 deletions
diff --git a/desktop/assistant/Assistant.qml b/desktop/assistant/Assistant.qml
index b038dd6..977b4dd 100644
--- a/desktop/assistant/Assistant.qml
+++ b/desktop/assistant/Assistant.qml
@@ -78,7 +78,9 @@ Scope {
// A conversation idle for 10 minutes is over: opening starts a new one,
// the old one staying in History. ponytail: a constant, not a setting.
function show() {
- if (turns.count && Date.now() - root.lastActive > 10 * 60 * 1000) root.fresh();
+ // Never while a reply runs: new would stop it, and a stopped turn is
+ // not saved.
+ if (turns.count && !root.busy && Date.now() - root.lastActive > 10 * 60 * 1000) root.fresh();
root.open = true;
}
@@ -120,15 +122,20 @@ Scope {
link.item.flush();
}
+ // The chips stay until the daemon's user event takes them: a refused
+ // file (unreadable, too big, a model without vision) comes back as an
+ // error, and the chips must still be there to fix it. chatting keeps the
+ // chat layout meanwhile, so the card does not shrink while a PDF is read.
function ask(text) {
if (!root.connected || root.blocked || (text.trim() === "" && !root.staged.length)) return false;
root.notice = "";
+ root.chatting = true;
root.send({ type: "ask", text: text, files: root.staged.map(f => f.path) });
- root.staged = [];
return true;
}
function showHistory() {
+ root.pickerOpen = false;
root.historyOpen = true;
root.send({ type: "list" });
}
@@ -172,15 +179,21 @@ Scope {
root.ctxUsed = e.ctx_used;
root.ctxMax = e.ctx_max;
root.load(e.id, e.turns, e.pending);
- if (e.pending) root.lastActive = Date.now();
+ // A restart or reload counts as active: the conversation it
+ // reconnects to is not stale just because this process is new.
+ if (e.pending || e.turns.length) root.lastActive = Date.now();
break;
case "conversation":
root.load(e.id, e.turns, null);
// Opened from History on purpose: it counts as active now.
if (e.turns.length) root.lastActive = Date.now();
+ // Emptied (New, or the current one deleted) with nothing staged:
+ // back to the entry line.
+ else if (!root.staged.length) root.chatting = false;
break;
case "user":
turns.append(root.row({ user: e.text, files: e.files }, true));
+ root.staged = [];
root.lastActive = Date.now();
break;
case "think": root.bufThink += e.delta; break;