Skip to content

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

fix(reasoning): use dictation agent's own credentials in self-hosted mode (#804)

Gabriel Stein3f61644e523b
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.js
index 2dc60043e..df7862c9c 100644
--- a/src/helpers/audioManager.js
+++ b/src/helpers/audioManager.js
@@ -38,7 +38,10 @@ function resolveReasoningRoute(text, settings, agentName) {
provider,
lanUrl: isSelfHostedAgent ? settings.dictationAgentRemoteUrl : undefined,
baseUrl: isCustomAgent ? settings.dictationAgentCloudBaseUrl || undefined : undefined,
- customApiKey: isCustomAgent ? settings.dictationAgentCustomApiKey || undefined : undefined,
+ customApiKey:
+ isCustomAgent || isSelfHostedAgent
+ ? settings.dictationAgentCustomApiKey || undefined
+ : undefined,
systemPrompt: resolvePrompt("dictationAgent", {
agentName,
language: settings.preferredLanguage,
diff --git a/src/services/ai/inferenceProviders/lan.ts b/src/services/ai/inferenceProviders/lan.ts
index 77ea79fc6..85b5ee94f 100644
--- a/src/services/ai/inferenceProviders/lan.ts
+++ b/src/services/ai/inferenceProviders/lan.ts
@@ -6,13 +6,18 @@ import logger from "../../../utils/logger";
export const lanProvider: InferenceProvider = {
id: "lan",
async call({ text, model, agentName, config, ctx }) {
- const lanUrl = (config.lanUrl || getSettings().cleanupRemoteUrl).trim();
+ const isAgentCall = !!config.lanUrl;
+ const settings = getSettings();
+ const lanUrl = (config.lanUrl || settings.cleanupRemoteUrl).trim();
logger.logReasoning("LAN_START", { url: lanUrl, agentName, model });
try {
const baseUrl = ensureV1Suffix(lanUrl);
const endpoint = buildApiUrl(baseUrl, "/chat/completions");
- const apiKey = config.customApiKey?.trim() || getSettings().cleanupCustomApiKey?.trim() || "";
+ const apiKey =
+ config.customApiKey?.trim() ||
+ (isAgentCall ? "" : settings.cleanupCustomApiKey?.trim()) ||
+ "";
const resolvedModel = model?.trim() || "default";
return await ctx.callChatCompletionsApi(
endpoint,