Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
Merge remote-tracking branch 'origin/main' into chore/update-reasoning-model-catalog
Gabriel Stein5b186e781cea
diff --cc src/services/ReasoningService.tsindex eb742d7e4,e1c822d26..01702128b--- a/src/services/ReasoningService.ts+++ b/src/services/ReasoningService.ts@@@ -176,9 -168,134 +168,134 @@@ class ReasoningService extends BaseReasreturn apiKey;}+ /**+ * Shared helper for OpenAI-compatible Chat Completions API calls.+ * Used by Groq and as fallback for OpenAI.+ */+ private async callChatCompletionsApi(+ endpoint: string,+ apiKey: string,+ model: string,+ text: string,+ agentName: string | null,+ config: ReasoningConfig,+ providerName: string+ ): Promise<string> {+ const systemPrompt = "You are a dictation assistant. Clean up text by fixing grammar and punctuation. Output ONLY the cleaned text without any explanations, options, or commentary.";+ const userPrompt = this.getReasoningPrompt(text, agentName, config);++ const messages = [+ { role: "system", content: systemPrompt },+ { role: "user", content: userPrompt }+ ];++ const requestBody: any = {+ model,+ messages,+ temperature: config.temperature ?? 0.3,+ max_tokens: config.maxTokens || Math.max(+ 4096,+ this.calculateMaxTokens(+ text.length,+ TOKEN_LIMITS.MIN_TOKENS,+ TOKEN_LIMITS.MAX_TOKENS,+ TOKEN_LIMITS.TOKEN_MULTIPLIER+ )+ ),+ };++ logger.logReasoning(`${providerName.toUpperCase()}_REQUEST`, {+ endpoint,+ model,+ hasApiKey: !!apiKey,+ requestBody: JSON.stringify(requestBody).substring(0, 200)+ });++ const response = await withRetry(+ async () => {+ const res = await fetch(endpoint, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ Authorization: `Bearer ${apiKey}`,+ },+ body: JSON.stringify(requestBody),+ });++ if (!res.ok) {+ const errorText = await res.text();+ let errorData: any = { error: res.statusText };++ try {+ errorData = JSON.parse(errorText);+ } catch {+ errorData = { error: errorText || res.statusText };+ }++ logger.logReasoning(`${providerName.toUpperCase()}_API_ERROR_DETAIL`, {+ status: res.status,+ statusText: res.statusText,+ error: errorData,+ errorMessage: errorData.error?.message || errorData.message || errorData.error,+ fullResponse: errorText.substring(0, 500)+ });++ const errorMessage = errorData.error?.message || errorData.message || errorData.error || `${providerName} API error: ${res.status}`;+ throw new Error(errorMessage);+ }++ const jsonResponse = await res.json();++ logger.logReasoning(`${providerName.toUpperCase()}_RAW_RESPONSE`, {+ hasResponse: !!jsonResponse,+ responseKeys: jsonResponse ? Object.keys(jsonResponse) : [],+ hasChoices: !!jsonResponse?.choices,+ choicesLength: jsonResponse?.choices?.length || 0,+ fullResponse: JSON.stringify(jsonResponse).substring(0, 500)+ });++ return jsonResponse;+ },+ createApiRetryStrategy()+ );++ // Extract text from Chat Completions format+ if (!response.choices || !response.choices[0]) {+ logger.logReasoning(`${providerName.toUpperCase()}_RESPONSE_ERROR`, {+ model,+ response: JSON.stringify(response).substring(0, 500),+ hasChoices: !!response.choices,+ choicesCount: response.choices?.length || 0+ });+ throw new Error(`Invalid response structure from ${providerName} API`);+ }++ const choice = response.choices[0];+ const responseText = choice.message?.content?.trim() || "";++ if (!responseText) {+ logger.logReasoning(`${providerName.toUpperCase()}_EMPTY_RESPONSE`, {+ model,+ finishReason: choice.finish_reason,+ hasMessage: !!choice.message,+ response: JSON.stringify(choice).substring(0, 500)+ });+ throw new Error(`${providerName} returned empty response`);+ }++ logger.logReasoning(`${providerName.toUpperCase()}_RESPONSE`, {+ model,+ responseLength: responseText.length,+ tokensUsed: response.usage?.total_tokens || 0,+ success: true+ });++ return responseText;+ }+async processText(text: string,- model: string = "gpt-4o-mini",+ model: string = "",agentName: string | null = null,config: ReasoningConfig = {}): Promise<string> {@@@ -208,17 -321,20 +325,20 @@@switch (provider) {case "openai":- result = await this.processWithOpenAI(text, model, agentName, config);+ result = await this.processWithOpenAI(text, trimmedModel, agentName, config);break;case "anthropic":- result = await this.processWithAnthropic(text, model, agentName, config);+ result = await this.processWithAnthropic(text, trimmedModel, agentName, config);break;case "local":- result = await this.processWithLocal(text, model, agentName, config);+ result = await this.processWithLocal(text, trimmedModel, agentName, config);break;case "gemini":- result = await this.processWithGemini(text, model, agentName, config);+ result = await this.processWithGemini(text, trimmedModel, agentName, config);break;+ case "groq":+ result = await this.processWithGroq(text, model, agentName, config);+ break;default:throw new Error(`Unsupported reasoning provider: ${provider}`);}