summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorTimo Clasen <[email protected]>2025-07-08 21:01:54 +0200
committerGitHub <[email protected]>2025-07-08 14:01:54 -0500
commit21fbf21cb666856c5b29c94617db759737825f24 (patch)
tree086596d6f14f5c60291fdfc5779d6a4f4958c1fb /packages
parentf31cbf2744cd14e5350d054e78d047a36b218f6c (diff)
downloadopencode-21fbf21cb666856c5b29c94617db759737825f24.tar.gz
opencode-21fbf21cb666856c5b29c94617db759737825f24.zip
fix(copilot): add vision request header (#773)
Diffstat (limited to 'packages')
-rw-r--r--packages/opencode/src/provider/provider.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.ts
index 730d920b4..920db882c 100644
--- a/packages/opencode/src/provider/provider.ts
+++ b/packages/opencode/src/provider/provider.ts
@@ -99,19 +99,27 @@ export namespace Provider {
info.access = tokens.access
}
let isAgentCall = false
+ let isVisionRequest = false
try {
const body = typeof init.body === "string" ? JSON.parse(init.body) : init.body
if (body?.messages) {
isAgentCall = body.messages.some((msg: any) => msg.role && ["tool", "assistant"].includes(msg.role))
+ isVisionRequest = body.messages.some(
+ (msg: any) =>
+ Array.isArray(msg.content) && msg.content.some((part: any) => part.type === "image_url"),
+ )
}
} catch {}
- const headers = {
+ const headers: Record<string, string> = {
...init.headers,
...copilot.HEADERS,
Authorization: `Bearer ${info.access}`,
"Openai-Intent": "conversation-edits",
"X-Initiator": isAgentCall ? "agent" : "user",
}
+ if (isVisionRequest) {
+ headers["Copilot-Vision-Request"] = "true"
+ }
delete headers["x-api-key"]
return fetch(input, {
...init,