Skip to content

Commit b7c6849

Browse files
authored
Merge pull request #2 from OpeOginni/feat/update-agent-check-for-responses-api-body
feat: Add support for responses api body
2 parents d37d222 + cbfd4f0 commit b7c6849

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

index.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export async function CopilotAuthPlugin({ client }) {
99
"Editor-Plugin-Version": "copilot-chat/0.32.4",
1010
"Copilot-Integration-Id": "vscode-chat",
1111
};
12+
const RESPONSES_API_ALTERNATE_INPUT_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", "reasoning"];
1213

1314
function normalizeDomain(url) {
1415
return url.replace(/^https?:\/\//, "").replace(/\/$/, "");
@@ -104,6 +105,16 @@ export async function CopilotAuthPlugin({ client }) {
104105
msg.content.some((part) => part.type === "image_url"),
105106
);
106107
}
108+
109+
if(body?.input) {
110+
const lastInput = body.input[body.input.length - 1];
111+
112+
const isAssistant = lastInput?.role === "assistant";
113+
const hasAgentType = lastInput?.type ? RESPONSES_API_ALTERNATE_INPUT_TYPES.includes(lastInput.type) : false;
114+
isAgentCall = isAssistant || hasAgentType;
115+
116+
isVisionRequest = Array.isArray(lastInput?.content) && lastInput.content.some((part) => part.type === "input_image");
117+
}
107118
} catch {}
108119
const headers = {
109120
...init.headers,

0 commit comments

Comments
 (0)