Skip to content

Commit 7a9efc1

Browse files
yfgeobviyus
authored andcommitted
fix: expose ollama thinking profile before activation
Fixes #77612
1 parent b8f9137 commit 7a9efc1

4 files changed

Lines changed: 34 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Docs: https://docs.openclaw.ai
6868

6969
### Fixes
7070

71+
- Ollama/thinking: expose the lightweight Ollama provider thinking profile through the public provider-policy artifact too, so reasoning-capable Ollama models such as `ollama/deepseek-v4-pro:cloud` keep `/think max` available even before the full plugin runtime activates. Fixes #77612. Thanks @rriggs.
7172
- CLI/sessions: prune old unreferenced transcript, compaction checkpoint, and trajectory artifacts during normal `sessions cleanup`, so gateway restart or crash orphans do not accumulate indefinitely outside `sessions.json`. Fixes #77608. Thanks @slideshow-dingo.
7273
- Video generation: wait up to 20 minutes for slow fal/MiniMax queue-backed jobs, stop forwarding unsupported Google Veo generated-audio options, and normalize MiniMax `720P` requests to its supported `768P` resolution with the usual override warning/details instead of failing fallback.
7374
- Update/restart: probe managed Gateway restarts with the service environment and add a Docker product lane that exercises candidate-owned `openclaw update --yes --json` restarts, so SecretRef-backed local gateway auth cannot regress behind mocked restart checks. Thanks @vincentkoc.

extensions/ollama/index.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
promptAndConfigureOllama,
2828
queryOllamaModelShowInfo,
2929
} from "./api.js";
30+
import { resolveThinkingProfile as resolveOllamaThinkingProfile } from "./provider-policy-api.js";
3031
import {
3132
OLLAMA_DEFAULT_API_KEY,
3233
OLLAMA_PROVIDER_ID,
@@ -249,13 +250,7 @@ export default definePluginEntry({
249250
contributeResolvedModelCompat: ({ model }) =>
250251
usesOllamaOpenAICompatTransport(model) ? { supportsUsageInStreaming: true } : undefined,
251252
resolveReasoningOutputMode: () => "native",
252-
resolveThinkingProfile: ({ reasoning }) => ({
253-
levels:
254-
reasoning === true
255-
? [{ id: "off" }, { id: "low" }, { id: "medium" }, { id: "high" }, { id: "max" }]
256-
: [{ id: "off" }],
257-
defaultLevel: "off",
258-
}),
253+
resolveThinkingProfile: resolveOllamaThinkingProfile,
259254
wrapStreamFn: createConfiguredOllamaCompatStreamWrapper,
260255
createEmbeddingProvider: async ({ config, model, provider: embeddingProvider, remote }) => {
261256
const { provider, client } = await createOllamaEmbeddingProvider({

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ModelDefinitionConfig } from "openclaw/plugin-sdk/provider-model-types";
22
import { describe, expect, it } from "vitest";
3-
import { normalizeConfig } from "./provider-policy-api.js";
3+
import { normalizeConfig, resolveThinkingProfile } from "./provider-policy-api.js";
44
import { OLLAMA_DEFAULT_BASE_URL } from "./src/defaults.js";
55

66
function createModel(id: string, name: string): ModelDefinitionConfig {
@@ -58,4 +58,15 @@ describe("ollama provider policy public artifact", () => {
5858
}),
5959
).toEqual({});
6060
});
61+
62+
it("exposes max thinking for reasoning-capable models without full plugin activation", () => {
63+
expect(resolveThinkingProfile({ reasoning: true })).toEqual({
64+
levels: [{ id: "off" }, { id: "low" }, { id: "medium" }, { id: "high" }, { id: "max" }],
65+
defaultLevel: "off",
66+
});
67+
expect(resolveThinkingProfile({ reasoning: false })).toEqual({
68+
levels: [{ id: "off" }],
69+
defaultLevel: "off",
70+
});
71+
});
6172
});

extensions/ollama/provider-policy-api.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1+
import type { ProviderThinkingProfile } from "openclaw/plugin-sdk/plugin-entry";
12
import type { ModelProviderConfig } from "openclaw/plugin-sdk/provider-model-types";
23
import { OLLAMA_DEFAULT_BASE_URL } from "./src/defaults.js";
34

45
type OllamaProviderConfigDraft = Partial<ModelProviderConfig>;
56

7+
const OLLAMA_REASONING_THINKING_PROFILE = {
8+
levels: [{ id: "off" }, { id: "low" }, { id: "medium" }, { id: "high" }, { id: "max" }],
9+
defaultLevel: "off",
10+
} satisfies ProviderThinkingProfile;
11+
12+
const OLLAMA_NON_REASONING_THINKING_PROFILE = {
13+
levels: [{ id: "off" }],
14+
defaultLevel: "off",
15+
} satisfies ProviderThinkingProfile;
16+
617
/**
718
* Provider policy surface for Ollama: normalize provider configs used by
819
* core defaults/normalizers. This runs during config defaults application and
@@ -38,3 +49,11 @@ export function normalizeConfig({
3849

3950
return next;
4051
}
52+
53+
export function resolveThinkingProfile({
54+
reasoning,
55+
}: {
56+
reasoning?: boolean;
57+
}): ProviderThinkingProfile {
58+
return reasoning ? OLLAMA_REASONING_THINKING_PROFILE : OLLAMA_NON_REASONING_THINKING_PROFILE;
59+
}

0 commit comments

Comments
 (0)