Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: leave room for thinking in a Custom connection's chat title request (#17332) (#17363)
Indrajit swainb23f37392048
diff --git a/studio/frontend/src/features/chat/utils/chat-title.ts b/studio/frontend/src/features/chat/utils/chat-title.tsindex ef451964cf5..5cbb1dd8e47 100644--- a/studio/frontend/src/features/chat/utils/chat-title.ts+++ b/studio/frontend/src/features/chat/utils/chat-title.ts@@ -356,11 +356,16 @@ function titleReasoningFields(};}-/** Forced reasoning counts toward the cap (Gemini 2.5 Pro forces 128), so add headroom. */+/** Forced reasoning counts toward the cap (Gemini 2.5 Pro forces 128), so add headroom; a Custom+ * connection without a reasoning dialect cannot turn thinking off (#17332). */function titleMaxTokens(connection: ResolvedExternalConnection): number {- const floor = getExternalMinOutputTokens(connection.provider.providerType);+ const { provider } = connection;+ const floor = getExternalMinOutputTokens(provider.providerType);const caps = titleReasoningCaps(connection);- const forcedReasoning = caps.supportsReasoning && !caps.supportsReasoningOff;+ const uncontrolled =+ toExternalBackendProviderType(provider.providerType) === "custom" &&+ provider.apiType !== "responses";+ const forcedReasoning = (caps.supportsReasoning || uncontrolled) && !caps.supportsReasoningOff;return Math.max(24, floor, forcedReasoning ? 1024 : 0);}diff --git a/studio/frontend/tests/chat-title-clip.test.ts b/studio/frontend/tests/chat-title-clip.test.tsindex 39920956edf..8daa098ec0c 100644--- a/studio/frontend/tests/chat-title-clip.test.ts+++ b/studio/frontend/tests/chat-title-clip.test.ts@@ -752,3 +752,17 @@ test("the title budget is floored at the provider's minimum output", async () =>assert.equal(request?.max_tokens, expected, model);}});++test("a Custom connection that cannot turn thinking off leaves room for it (#17332)", async () => {+ const budget = async (overrides: Record<string, unknown>) => {+ stageConnection({ providerType: "custom", models: ["qwen3"], ...overrides });+ return (await buildTitleRequest("external::conn-1::qwen3", "x"))?.max_tokens;+ };+ assert.equal(await budget({}), 1024);+ assert.equal(await budget({ reasoningConfig: { enabled: false, style: "reasoning_effort" } }), 1024);+ // An enabled dialect sends thinking off, so the plain cap stands.+ assert.equal(await budget({ reasoningConfig: { enabled: true, style: "chat_template_kwargs.enable_thinking" } }), 64);+ for (const providerType of ["llama_cpp", "vllm", "ollama"]) {+ assert.equal(await budget({ providerType }), 64, providerType);+ }+});