mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-15 20:52:01 +03:00
fix(core): add thinking toggle variants for Vertex MaaS models (#54040)
This commit is contained in:
committed by
GitHub
Unverified
parent
3a2fa2b9d2
commit
ea666727a1
@@ -79,6 +79,17 @@ const openaiChat: Protocol = (_, support) => {
|
||||
return efforts(support.values ?? EFFORTS, (effort) => ({ settings: { reasoningEffort: effort } }))
|
||||
}
|
||||
|
||||
// Vertex MaaS models switch thinking through the chat template. DeepSeek names the flag `thinking`; the
|
||||
// others (GLM, Gemma) use `enable_thinking`.
|
||||
const vertexChat: Protocol = (model, support) => {
|
||||
if (support.type !== "toggle") return openaiChat(model, support)
|
||||
const key = modelID(model).toLowerCase().includes("deepseek") ? "thinking" : "enable_thinking"
|
||||
return toggle(
|
||||
{ body: { chat_template_kwargs: { [key]: false } } },
|
||||
{ body: { chat_template_kwargs: { [key]: true } } },
|
||||
)
|
||||
}
|
||||
|
||||
const openaiResponses: Protocol = (_, support) => {
|
||||
if (support.type !== "effort") return []
|
||||
return efforts(support.values ?? ["none", "minimal", ...EFFORTS, "xhigh"], responsesEffort)
|
||||
@@ -576,7 +587,7 @@ const PROTOCOLS: Readonly<Record<string, Protocol>> = {
|
||||
|
||||
"@opencode/ai/providers/openai-compatible": openaiCompatible,
|
||||
"@opencode/ai/providers/azure/chat": openaiChat,
|
||||
"@opencode/ai/providers/google-vertex/chat": openaiChat,
|
||||
"@opencode/ai/providers/google-vertex/chat": vertexChat,
|
||||
"@opencode/ai/providers/alibaba/chat": alibabaChat,
|
||||
"@opencode/ai/providers/baseten": basetenChat,
|
||||
"@opencode/ai/providers/cerebras": openaiChat,
|
||||
|
||||
Reference in New Issue
Block a user