From 2d51494f7aa574da3b054a8bbdcf2532ff32a71f Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 19 Oct 2026 11:36:00 +0200 Subject: assistant: grey out the mic when the model cannot hear AssistantModule keeps each router model's input_modalities and exposes hears: the model loading, else the first not unloaded (the daemon's rule), reports audio. Unknown inputs or a router that is down count as yes; the daemon's error covers the rest. The model list is now read on every canvas open, not only when a preferred model is set, so hears is current when the card shows. Checked: the rule against the router's live /models (Gemma resident: on; Qwen resident or loading: off; router down: on). Not yet seen by eye after a desktop shell reload. Co-Authored-By: Claude Opus 5.5 --- desktop/assistant/Assistant.qml | 5 ++++- desktop/assistant/Card.qml | 3 ++- desktop/assistant/README.md | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'desktop/assistant') diff --git a/desktop/assistant/Assistant.qml b/desktop/assistant/Assistant.qml index 865f157..c4d0771 100644 --- a/desktop/assistant/Assistant.qml +++ b/desktop/assistant/Assistant.qml @@ -212,9 +212,12 @@ Scope { property var mic: null // the recording's Process, null when not recording property int micSecs: 0 readonly property bool recording: root.mic !== null + // Whether the model in use takes audio. Set from shell.qml. + property bool hears: true function record() { - if (root.recording || !root.connected || root.busy || root.opRunning || root.blocked) return; + if (root.recording || !root.connected || !root.hears || root.busy || root.opRunning + || root.blocked) return; root.notice = ""; root.micSecs = 0; root.mic = micRun.createObject(root); diff --git a/desktop/assistant/Card.qml b/desktop/assistant/Card.qml index d8826fa..85066fe 100644 --- a/desktop/assistant/Card.qml +++ b/desktop/assistant/Card.qml @@ -443,7 +443,8 @@ Rectangle { : "" danger: card.canvas.recording enabled: card.canvas.connected && (card.canvas.recording - || (!card.canvas.busy && !card.canvas.opRunning && !card.canvas.blocked)) + || (card.canvas.hears && !card.canvas.busy && !card.canvas.opRunning + && !card.canvas.blocked)) onClicked: { if (card.canvas.recording) card.canvas.endRecording(true); else card.canvas.record(); diff --git a/desktop/assistant/README.md b/desktop/assistant/README.md index bd61cb4..be95eb7 100644 --- a/desktop/assistant/README.md +++ b/desktop/assistant/README.md @@ -34,7 +34,9 @@ beneath the overlay that holds the keyboard. The mic records with `pw-record` into `$XDG_RUNTIME_DIR/assistant-mic.wav` until clicked again (at most 59 s), then asks with it: the daemon has the -model transcribe it and answers the words. +model transcribe it and answers the words. The mic is greyed out while the +model in use reports no `audio` input (`AssistantModule.hears`, from the +router's `/models`, read on every open). Keys: Enter sends, Shift+Enter is a newline, Escape cancels a recording, then closes the picker, the history panel, then the card. Stop replaces -- cgit v1.2.3