Skip to content

Commit 2252fdc

Browse files
committed
feat: Add support for responses api body
1 parent 1c8425d commit 2252fdc

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

index.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export async function CopilotAuthPlugin({ client }) {
1313
"Editor-Plugin-Version": "copilot-chat/0.31.2",
1414
"Copilot-Integration-Id": "vscode-chat",
1515
};
16+
const RESPONSES_API_TOOL_TYPES = ["file_search_call", "computer_call", "computer_call_output", "web_search_call", "function_call", "function_call_output", "image_generation_call", "code_interpreter_call", "local_shell_call", "local_shell_call_output", "mcp_list_tools", "mcp_approval_request", "mcp_approval_response", "mcp_call"];
1617

1718
return {
1819
auth: {
@@ -78,6 +79,17 @@ export async function CopilotAuthPlugin({ client }) {
7879
msg.content.some((part) => part.type === "image_url"),
7980
);
8081
}
82+
83+
if(body?.input) {
84+
isAgentCall = body.input.some(
85+
(input) => (input.role && ["assistant"].includes(input.role)) || (input.type && RESPONSES_API_TOOL_TYPES.includes(input.type)),
86+
)
87+
isVisionRequest = body.input.some(
88+
(input) =>
89+
Array.isArray(input.content) &&
90+
input.content.some((part) => part.type === "input_image"),
91+
);
92+
}
8193
} catch {}
8294
const headers = {
8395
...init.headers,

0 commit comments

Comments
 (0)