Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(translation): route local models with an empty provider through llama.cpp

Alcahest9e1ab8419643
diff --git a/src/components/ReasoningModelSelector.tsx b/src/components/ReasoningModelSelector.tsx
index 9952dc3a0..504820217 100644
--- a/src/components/ReasoningModelSelector.tsx
+++ b/src/components/ReasoningModelSelector.tsx
@@ -528,6 +528,14 @@ export default function ReasoningModelSelector({
}
};
+ const handleLocalModelSelect = (modelId: string) => {
+ // Persist the owning catalog provider with the model: an empty provider
+ // sends this scope's routing through another scope's heuristics.
+ const owner = modelId ? modelRegistry.getModel(modelId)?.provider.id : undefined;
+ if (owner) setLocalReasoningProvider(owner);
+ setReasoningModel(modelId);
+ };
+
const MODE_TABS = [
{ id: "cloud", name: t("reasoning.mode.cloud") },
{ id: "local", name: t("reasoning.mode.local") },
@@ -721,7 +729,7 @@ export default function ReasoningModelSelector({
providers={localProviders}
selectedModel={reasoningModel}
selectedProvider={selectedLocalProvider}
- onModelSelect={setReasoningModel}
+ onModelSelect={handleLocalModelSelect}
onProviderSelect={handleLocalProviderChange}
modelType="llm"
colorScheme="purple"
diff --git a/src/components/ui/PromptStudio.tsx b/src/components/ui/PromptStudio.tsx
index db4d477ef..78c23b0ec 100644
--- a/src/components/ui/PromptStudio.tsx
+++ b/src/components/ui/PromptStudio.tsx
@@ -29,6 +29,7 @@ import {
import { getLanguageLabel } from "../../utils/languageSupport";
import { getDictionaryHintWords } from "../../utils/snippets";
import { resolveDictationAgentInference } from "../../helpers/dictationAgentInference";
+import { resolveTranslationProviderId } from "../../helpers/dictationRouting";
interface PromptStudioProps {
className?: string;
@@ -151,9 +152,11 @@ export default function PromptStudio({ className = "", kind = "cleanup" }: Promp
return;
}
- const provider = isCloudTranslation
- ? "openwhispr"
- : translationProvider.trim() || undefined;
+ const provider = resolveTranslationProviderId({
+ isCloudTranslation,
+ translationMode,
+ translationProvider,
+ });
const modelToUse = isCloudTranslation ? translationModel || "auto" : translationModel;
const previous = customPrompt;
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.js
index de95efde4..e73210dab 100644
--- a/src/helpers/audioManager.js
+++ b/src/helpers/audioManager.js
@@ -70,6 +70,7 @@ import { detectAgentName } from "../config/agentDetection";
import {
resolveDictationRouteKind,
resolveDictationTranslationReachability,
+ resolveTranslationProviderId,
} from "./dictationRouting";
import { resolveDictationAgentInference } from "./dictationAgentInference";
import { resolvePrompt } from "../config/prompts";
@@ -164,9 +165,11 @@ function resolveReasoningRoute(
);
}
if (kind === "translation") {
- const provider = isCloudTranslation
- ? "openwhispr"
- : settings.translationProvider?.trim() || undefined;
+ const provider = resolveTranslationProviderId({
+ isCloudTranslation,
+ translationMode: settings.translationMode,
+ translationProvider: settings.translationProvider,
+ });
const isCustomTranslation = settings.translationMode === "providers" && provider === "custom";
return {
kind: "translation",
diff --git a/src/helpers/dictationRouting.js b/src/helpers/dictationRouting.js
index 3a1070764..18c0f26c8 100644
--- a/src/helpers/dictationRouting.js
+++ b/src/helpers/dictationRouting.js
@@ -41,6 +41,19 @@ export function resolveDictationAgentProvider({
return dictationAgentProvider?.trim() || undefined;
}
+// Provider id the translate steps hand to ReasoningService. An empty provider
+// in local mode still routes to llama.cpp instead of cleanup-scope heuristics.
+export function resolveTranslationProviderId({
+ isCloudTranslation,
+ translationMode,
+ translationProvider,
+}) {
+ if (isCloudTranslation) return "openwhispr";
+ const provider = translationProvider?.trim();
+ if (provider) return provider;
+ return translationMode === "local" ? "local" : undefined;
+}
+
// Decides which reasoning path ("translation" | "agent" | "cleanup" | "skip")
// a finished dictation takes. A recording started via the voice agent hotkey
// always takes the agent path — no wake word needed — and never falls back to
diff --git a/test/helpers/dictationRouting.test.js b/test/helpers/dictationRouting.test.js
index 7c9d4aba1..07eea3157 100644
--- a/test/helpers/dictationRouting.test.js
+++ b/test/helpers/dictationRouting.test.js
@@ -395,3 +395,77 @@ test("blank stored provider resolves to undefined outside local mode", async ()
undefined
);
});
+
+test("translation provider: cloud mode always routes to openwhispr", async () => {
+ const { resolveTranslationProviderId } = await load();
+
+ assert.equal(
+ resolveTranslationProviderId({
+ isCloudTranslation: true,
+ translationMode: "local",
+ translationProvider: "llama",
+ }),
+ "openwhispr"
+ );
+});
+
+test("translation provider: an explicit provider passes through trimmed", async () => {
+ const { resolveTranslationProviderId } = await load();
+
+ assert.equal(
+ resolveTranslationProviderId({
+ isCloudTranslation: false,
+ translationMode: "providers",
+ translationProvider: " groq ",
+ }),
+ "groq"
+ );
+
+ const { resolveTranslationProviderId: resolve } = await load();
+ assert.equal(
+ resolve({
+ isCloudTranslation: false,
+ translationMode: "local",
+ translationProvider: "qwen",
+ }),
+ "qwen"
+ );
+});
+
+test("translation provider: empty provider in local mode routes to llama.cpp", async () => {
+ const { resolveTranslationProviderId } = await load();
+
+ // Picking a local model without ever clicking a provider tab leaves the
+ // stored provider empty; local mode must still resolve locally.
+ assert.equal(
+ resolveTranslationProviderId({
+ isCloudTranslation: false,
+ translationMode: "local",
+ translationProvider: "",
+ }),
+ "local"
+ );
+});
+
+test("translation provider: empty provider outside local mode stays undefined", async () => {
+ const { resolveTranslationProviderId } = await load();
+
+ assert.equal(
+ resolveTranslationProviderId({
+ isCloudTranslation: false,
+ translationMode: "providers",
+ translationProvider: " ",
+ }),
+ undefined
+ );
+
+ const { resolveTranslationProviderId: resolve } = await load();
+ assert.equal(
+ resolve({
+ isCloudTranslation: false,
+ translationMode: "self-hosted",
+ translationProvider: "",
+ }),
+ undefined
+ );
+});