Skip to content

A personal assistant that lives on your desktop, remembers what matters, and can use your Mac for you.

TypeScript

feat(voice): name the listening engine on the Voice entry

Alan Buscaglia13964577f9fb
diff --git a/packages/ui/src/components/VoiceModel.tsx b/packages/ui/src/components/VoiceModel.tsx
index ca34103..57d1e98 100644
--- a/packages/ui/src/components/VoiceModel.tsx
+++ b/packages/ui/src/components/VoiceModel.tsx
@@ -18,6 +18,13 @@ const ENGINES: Record<VoiceModelStatus["engine"], string> = {
none: "Voice input needs the local model on this computer",
};
+/** The chip names the engine that listens now. */
+const CHIPS: Record<VoiceModelStatus["engine"], string> = {
+ parakeet: "Offline",
+ apple: "macOS",
+ none: "Off",
+};
+
const megabytes = (bytes: number) => `${Math.round(bytes / 1_000_000)} MB`;
type Progress = { kind: "downloading"; percent: number } | { kind: "verifying" };
@@ -80,7 +87,7 @@ export function VoiceModelEntry() {
<li className="computer-entry" aria-labelledby="connector-voice">
<div className="provider-name">
<b id="connector-voice">Voice</b>
- <span className="chip connector-connected">Built in</span>
+ {status ? <span className="chip connector-connected">{CHIPS[status.engine]}</span> : null}
</div>
{status ? <p className="connector-note">{ENGINES[status.engine]}</p> : null}
<p className="connector-note">
diff --git a/packages/ui/test/voice-model.test.tsx b/packages/ui/test/voice-model.test.tsx
index 5d6f307..56b0b5e 100644
--- a/packages/ui/test/voice-model.test.tsx
+++ b/packages/ui/test/voice-model.test.tsx
@@ -45,6 +45,7 @@ describe("local voice model (S30.5)", () => {
it("downloads only when asked, showing the size and the progress", async () => {
render(<VoiceModelEntry />);
expect(await screen.findByText("Using: macOS speech")).toBeInTheDocument();
+ expect(screen.getByText("macOS")).toHaveClass("chip");
expect(h.invoke).not.toHaveBeenCalledWith("voice_model_download", undefined);
await userEvent.click(screen.getByRole("button", { name: "Download local voice model (487 MB)" }));
@@ -76,6 +77,8 @@ describe("local voice model (S30.5)", () => {
h.status = { installed: true, bytes: 670_478_772, downloading: false, engine: "parakeet" };
render(<VoiceModelEntry />);
expect(await screen.findByText("Using: local model (Parakeet), works offline")).toBeInTheDocument();
+ expect(screen.getByText("Offline")).toHaveClass("chip");
+ expect(screen.queryByText("Built in")).toBeNull();
h.status = { installed: false, downloading: false, engine: "apple" };
await userEvent.click(screen.getByRole("button", { name: "Remove local model (670 MB)" }));