Skip to content

Commit 30829ec

Browse files
committed
fix(opencode-go): register thinking profile to enable xhigh/max support
Add resolveThinkingProfile hook for opencode-go DeepSeek V4 models, exposing the full thinking level range (off~max). The stream wrapper already handles reasoning_effort mapping correctly via the shared createDeepSeekV4OpenAICompatibleThinkingWrapper; this change only fixes the UI/gateway display so xhigh and max become selectable. API verification results (against opencode.ai/zen/go/v1): - reasoning_effort: max -> 200 + reasoning_content (134 tokens) - reasoning_effort: high -> 200 + reasoning_content (119 tokens) - thinking: disabled -> 200 + direct answer (no reasoning)
1 parent 741d952 commit 30829ec

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

‎extensions/opencode-go/index.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
resolveOpencodeGoModel,
1414
} from "./provider-catalog.js";
1515
import { createOpencodeGoWrapper } from "./stream.js";
16+
import { resolveOpencodeGoDeepSeekV4ThinkingProfile } from "./thinking.js";
1617

1718
const PROVIDER_ID = "opencode-go";
1819
const OPENCODE_SHARED_PROFILE_IDS = ["opencode:default", "opencode-go:default"] as const;
@@ -137,6 +138,8 @@ export default definePluginEntry({
137138
augmentModelCatalog: () => listOpencodeGoModelCatalogEntries(),
138139
...PASSTHROUGH_GEMINI_REPLAY_HOOKS,
139140
wrapStreamFn: (ctx) => createOpencodeGoWrapper(ctx.streamFn, ctx.thinkingLevel),
141+
resolveThinkingProfile: ({ modelId }) =>
142+
resolveOpencodeGoDeepSeekV4ThinkingProfile(modelId),
140143
isModernModelRef: () => true,
141144
});
142145
api.registerMediaUnderstandingProvider(opencodeGoMediaUnderstandingProvider);

‎extensions/opencode-go/thinking.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import type { ProviderThinkingProfile } from "openclaw/plugin-sdk/plugin-entry";
2+
3+
const V4_THINKING_LEVEL_IDS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"] as const;
4+
5+
function buildV4ThinkingLevel(id: (typeof V4_THINKING_LEVEL_IDS)[number]) {
6+
return { id };
7+
}
8+
9+
const OPENCODE_GO_DEEPSEEK_V4_THINKING_PROFILE = {
10+
levels: V4_THINKING_LEVEL_IDS.map(buildV4ThinkingLevel),
11+
defaultLevel: "high",
12+
} satisfies ProviderThinkingProfile;
13+
14+
function isOpencodeGoDeepSeekV4ModelId(modelId: string): boolean {
15+
const id = modelId.trim().toLowerCase();
16+
return id === "deepseek-v4-pro" || id === "deepseek-v4-flash";
17+
}
18+
19+
export function resolveOpencodeGoDeepSeekV4ThinkingProfile(
20+
modelId: string,
21+
): ProviderThinkingProfile | undefined {
22+
return isOpencodeGoDeepSeekV4ModelId(modelId)
23+
? OPENCODE_GO_DEEPSEEK_V4_THINKING_PROFILE
24+
: undefined;
25+
}

0 commit comments

Comments
 (0)