Skip to content

Commit d632557

Browse files
committed
fix(ollama): show full thinking menu for live-discovered models without catalog entry
When an Ollama model is discovered at runtime (not in the static config catalog), its reasoning flag is undefined. The provider policy returned the non-reasoning thinking profile (only off) when reasoning was not explicitly true, causing Telegram /think to show only default, off even though /think <level> worked. Fix: treat reasoning: undefined as reasoning-capable, since live- discovered models that report thinking capability should show the full thinking level menu. Models with explicit reasoning: false in the catalog are unaffected. Fixes #93835
1 parent bbe9669 commit d632557

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

extensions/ollama/provider-policy-api.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,17 @@ describe("ollama provider policy public artifact", () => {
6161
});
6262

6363
it("exposes max thinking for reasoning-capable models without full plugin activation", () => {
64-
expect(resolveThinkingProfile({ reasoning: true })).toEqual({
64+
const reasoningProfile = {
6565
levels: [{ id: "off" }, { id: "low" }, { id: "medium" }, { id: "high" }, { id: "max" }],
6666
defaultLevel: "off",
67-
});
67+
};
68+
expect(resolveThinkingProfile({ reasoning: true })).toEqual(reasoningProfile);
6869
expect(resolveThinkingProfile({ reasoning: false })).toEqual({
6970
levels: [{ id: "off" }],
7071
defaultLevel: "off",
7172
});
73+
// Live-discovered models without catalog entry default to capable.
74+
expect(resolveThinkingProfile({})).toEqual(reasoningProfile);
75+
expect(resolveThinkingProfile({ reasoning: undefined })).toEqual(reasoningProfile);
7276
});
7377
});

extensions/ollama/provider-policy-api.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,10 @@ export function resolveThinkingProfile({
5656
}: {
5757
reasoning?: boolean;
5858
}): ProviderThinkingProfile {
59-
return reasoning ? OLLAMA_REASONING_THINKING_PROFILE : OLLAMA_NON_REASONING_THINKING_PROFILE;
59+
// reasoning=true -> known reasoning model, show full thinking menu
60+
// reasoning=false -> known non-reasoning model, show only "off"
61+
// reasoning=undefined -> live-discovered / no catalog entry, assume capable
62+
return reasoning !== false
63+
? OLLAMA_REASONING_THINKING_PROFILE
64+
: OLLAMA_NON_REASONING_THINKING_PROFILE;
6065
}

0 commit comments

Comments
 (0)