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): stop sending Ollama-only `think` field to Groq (#757)

Gabriel Steinf68567127bd4
diff --git a/src/services/ai/thinkingSuppression.ts b/src/services/ai/thinkingSuppression.ts
index 76965eedb..f0d6a2fe9 100644
--- a/src/services/ai/thinkingSuppression.ts
+++ b/src/services/ai/thinkingSuppression.ts
@@ -1,22 +1,38 @@
import type { ReasoningConfig } from "../BaseReasoningService";
import { getCloudModel, getLocalModel } from "../../models/ModelRegistry";
-// Sends both `reasoning_effort` (OpenAI/Groq dialect) and `think` (Ollama
-// dialect); servers ignore unknown fields. Skips known non-thinking models
-// to avoid suppressing reasoning on models like gpt-5 where the user toggle
-// is hidden but the default value still applies.
+// Strict OpenAI-compatible servers (Groq, LM Studio, vLLM, LocalAI) reject
+// unknown fields like `think` with "property 'think' is unsupported". Only
+// Ollama-native servers accept `think`; everyone else uses `reasoning_effort`.
+// The `lan` provider defaults to Ollama dialect, but legacy users who
+// configured Self-Hosted as "openai-compatible" still route through `lan`
+// — honor that flag so their backend doesn't reject the request.
+function usesOllamaDialect(providerKey: string): boolean {
+ if (providerKey === "local") return true;
+ if (providerKey !== "lan") return false;
+ if (typeof window === "undefined") return true;
+ return window.localStorage?.getItem("remoteReasoningType") !== "openai-compatible";
+}
+
+function suppressThinking(requestBody: Record<string, unknown>, providerKey: string): void {
+ if (usesOllamaDialect(providerKey)) {
+ requestBody.think = false;
+ } else {
+ requestBody.reasoning_effort = "none";
+ }
+}
+
export function applyThinkingSuppression(
requestBody: Record<string, unknown>,
model: string,
provider: string,
config: ReasoningConfig
): void {
+ const providerKey = provider.toLowerCase();
const cloudModel = getCloudModel(model);
- const curatedGroqSuppress = !!cloudModel?.disableThinking && provider.toLowerCase() === "groq";
- if (curatedGroqSuppress) {
- requestBody.reasoning_effort = "none";
- requestBody.think = false;
+ if (cloudModel?.disableThinking && providerKey === "groq") {
+ suppressThinking(requestBody, providerKey);
return;
}
@@ -26,6 +42,5 @@ export function applyThinkingSuppression(
const knownModel = cloudModel || localModel;
if (knownModel && !knownModel.supportsThinking) return;
- requestBody.reasoning_effort = "none";
- requestBody.think = false;
+ suppressThinking(requestBody, providerKey);
}