fix: skip function_call items with empty/missing name to prevent Codex 400 error (closes #444) (#487)
This commit is contained in:
parent
38eabae2e7
commit
5fe2c81cf9
2 changed files with 4 additions and 0 deletions
|
|
@ -87,6 +87,8 @@ export function convertResponsesApiFormat(body) {
|
||||||
tool_calls: []
|
tool_calls: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// Skip items with empty/missing name — upstream APIs reject nameless tool calls (#444)
|
||||||
|
if (!item.name || typeof item.name !== "string" || item.name.trim() === "") continue;
|
||||||
currentAssistantMsg.tool_calls.push({
|
currentAssistantMsg.tool_calls.push({
|
||||||
id: item.call_id,
|
id: item.call_id,
|
||||||
type: "function",
|
type: "function",
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ export function openaiResponsesToOpenAIRequest(model, body, stream, credentials)
|
||||||
tool_calls: []
|
tool_calls: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// Skip items with empty/missing name — Codex/OpenAI reject nameless tool calls (#444)
|
||||||
|
if (!item.name || typeof item.name !== "string" || item.name.trim() === "") continue;
|
||||||
currentAssistantMsg.tool_calls.push({
|
currentAssistantMsg.tool_calls.push({
|
||||||
id: item.call_id,
|
id: item.call_id,
|
||||||
type: "function",
|
type: "function",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue