Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

feat(freeflow): show voice button disabled with tooltip when Groq key missing

Chaitanya Girid96d651798d3
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index c755f1c1..c6c26966 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -53,6 +53,10 @@ export function App() {
// Mirror the Free Flow flag into the store so the composer mic button shows
// only when enabled (Settings keeps this in sync on save).
useStore.getState().setFreeflowEnabled(!!c.freeflowEnabled);
+ // Mirror boolean key-presence ONLY (never the key value) so the composer can
+ // show the voice button disabled-with-tooltip when Free Flow is on but no
+ // Groq key is set (Settings keeps this in sync on save).
+ useStore.getState().setHasGroqKey(!!c.groqApiKey);
// Mirror the active office theme so OfficeFloor renders it (gated on the
// tvShowOffices flag; off = always the office). Settings keeps this synced.
useStore.getState().setOfficeTheme(c.tvShowOffices ? (c.officeTheme ?? 'office') : 'office');
diff --git a/src/renderer/src/components/MessageQueueComposer.tsx b/src/renderer/src/components/MessageQueueComposer.tsx
index 747cf078..be4176d0 100644
--- a/src/renderer/src/components/MessageQueueComposer.tsx
+++ b/src/renderer/src/components/MessageQueueComposer.tsx
@@ -40,8 +40,11 @@ export function MessageQueueComposer({ agent }: MessageQueueComposerProps) {
// Free Flow voice dictation (entry point A). The mic button shows only when the
// feature is enabled in Settings; a transcript is appended to this draft for
- // review before sending (never auto-sent).
+ // review before sending (never auto-sent). When enabled but no Groq key is set,
+ // the button stays VISIBLE but DISABLED with a tooltip pointing to Settings
+ // (hasGroqKey is boolean presence only — the key value never reaches the store).
const freeflowEnabled = useStore((s) => s.freeflowEnabled);
+ const hasGroqKey = useStore((s) => s.hasGroqKey);
const ff = useFreeflow();
const ffMine = ff.targetAgentId === agent.id;
const ffHint = !freeflowEnabled
@@ -333,7 +336,7 @@ export function MessageQueueComposer({ agent }: MessageQueueComposerProps) {
<Icon name="plus" /> files
</span>
</PixelButton>
- {freeflowEnabled && <FreeFlowButton agentId={agent.id} />}
+ {freeflowEnabled && <FreeFlowButton agentId={agent.id} hasGroqKey={hasGroqKey} />}
<PixelButton variant="primary" size="sm" onClick={queueIt} disabled={!canSend}>
<span style={{ display: 'inline-flex', gap: 6, alignItems: 'center' }}>
send <Icon name="arrow-right" />
@@ -390,32 +393,41 @@ function DelegateSwitch({ on, onToggle }: { on: boolean; onToggle: () => void })
* again to stop → transcribe → the text is appended to this agent's draft. While
* another agent is mid-dictation it's disabled (one shared recorder). The actual
* capture + Groq call live in the freeflow recorder singleton.
+ *
+ * When no Groq key is configured the button stays visible but disabled, with a
+ * tooltip pointing to Settings — it never starts a recording, so getUserMedia and
+ * the Groq STT call are never reached (preserving the zero-call-when-unavailable
+ * guarantee). `hasGroqKey` is boolean presence only; the key value never gets here.
*/
-function FreeFlowButton({ agentId }: { agentId: string }) {
+function FreeFlowButton({ agentId, hasGroqKey }: { agentId: string; hasGroqKey: boolean }) {
const ff = useFreeflow();
const mine = ff.targetAgentId === agentId;
const recording = ff.status === 'recording' && mine;
const transcribing = ff.status === 'transcribing' && mine;
// Block while another agent's clip is recording/uploading (single recorder).
const busyElsewhere = ff.status !== 'idle' && !mine;
+ const noKey = !hasGroqKey;
+ const title = noKey
+ ? 'Add a Groq API key in Settings → Free Flow to use voice mode.'
+ : recording ? 'Stop & transcribe'
+ : transcribing ? 'Transcribing…'
+ : 'Free Flow — dictate into the queue (push to talk)';
+ // Wrap in a (non-disabled) span so the native title tooltip still shows on hover
+ // even when the inner button is disabled — Chromium suppresses tooltips on a
+ // disabled <button> itself.
return (
- <PixelButton
- variant={recording ? 'destructive' : 'secondary'}
- size="sm"
- onClick={() => freeflowRecorder.toggle(agentId)}
- disabled={transcribing || busyElsewhere}
- >
- <span
- title={
- recording ? 'Stop & transcribe'
- : transcribing ? 'Transcribing…'
- : 'Free Flow — dictate into the queue (push to talk)'
- }
- style={{ display: 'inline-flex', gap: 6, alignItems: 'center' }}
+ <span title={title} style={{ display: 'inline-flex' }}>
+ <PixelButton
+ variant={recording ? 'destructive' : 'secondary'}
+ size="sm"
+ onClick={() => { if (noKey) return; freeflowRecorder.toggle(agentId); }}
+ disabled={noKey || transcribing || busyElsewhere}
>
- <Icon name="mic" />
- {transcribing ? '…' : recording ? 'stop' : 'voice'}
- </span>
- </PixelButton>
+ <span style={{ display: 'inline-flex', gap: 6, alignItems: 'center' }}>
+ <Icon name="mic" />
+ {transcribing ? '…' : recording ? 'stop' : 'voice'}
+ </span>
+ </PixelButton>
+ </span>
);
}
diff --git a/src/renderer/src/components/SettingsModal.tsx b/src/renderer/src/components/SettingsModal.tsx
index dc962a87..aa14f862 100644
--- a/src/renderer/src/components/SettingsModal.tsx
+++ b/src/renderer/src/components/SettingsModal.tsx
@@ -233,6 +233,7 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
// --- Free Flow (voice dictation → message queue) ---
const setFreeflowEnabledStore = useStore((s) => s.setFreeflowEnabled);
+ const setHasGroqKeyStore = useStore((s) => s.setHasGroqKey);
const [freeflowEnabled, setFreeflowEnabled] = useState(slackCfg.freeflowEnabled ?? false);
const [groqKey, setGroqKey] = useState(slackCfg.groqApiKey ?? '');
const [freeflowModel, setFreeflowModel] = useState(slackCfg.freeflowModel ?? 'whisper-large-v3-turbo');
@@ -400,6 +401,9 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {
model: freeflowModel.trim() || 'whisper-large-v3-turbo'
});
setFreeflowEnabledStore(enabled);
+ // Mirror boolean key-presence so the voice button enables/disables live
+ // without an app restart (presence only — never the key value).
+ setHasGroqKeyStore(!!groqKey.trim());
setFreeflowNote('saved');
} catch (e) {
setFreeflowNote(e instanceof Error ? e.message : String(e));
diff --git a/src/renderer/src/store/store.ts b/src/renderer/src/store/store.ts
index fc039f48..4b765756 100644
--- a/src/renderer/src/store/store.ts
+++ b/src/renderer/src/store/store.ts
@@ -180,6 +180,12 @@ interface State {
* mic button reactively (set by App on config load and by Settings on save). */
freeflowEnabled: boolean;
setFreeflowEnabled: (on: boolean) => void;
+ /** Mirror of `!!config.groqApiKey` — boolean presence ONLY; the key value never
+ * enters the store. Lets the composer show the voice button disabled (with a
+ * "add a Groq key" tooltip) instead of hiding it. Set by App on config load and
+ * by Settings on save. */
+ hasGroqKey: boolean;
+ setHasGroqKey: (has: boolean) => void;
/** Mirror of the active office theme (set by App on config load + by Settings
* on switch). OfficeFloor depends on this and rebuilds the scene on change. */
officeTheme: ThemeId;
@@ -480,6 +486,8 @@ export const useStore = create<State>((set) => ({
set((s) => ({ drafts: { ...s.drafts, [agentId]: text } })),
freeflowEnabled: false,
setFreeflowEnabled: (on) => set({ freeflowEnabled: on }),
+ hasGroqKey: false,
+ setHasGroqKey: (has) => set({ hasGroqKey: has }),
officeTheme: 'office',
setOfficeTheme: (theme) => set({ officeTheme: theme }),
enqueueMessage: (agentId, text, meta) =>