Fixed Codex

This commit is contained in:
decolua
2026-02-21 14:36:06 +07:00
parent f2025cc776
commit adf57aa0c9
18 changed files with 1419 additions and 1627 deletions

View File

@@ -100,6 +100,7 @@ export function generateProjectId() {
}
// Helper: Remove unsupported keywords recursively from object/array
// Also strips all vendor extension fields (x- prefixed) not supported by Gemini
function removeUnsupportedKeywords(obj, keywords) {
if (!obj || typeof obj !== "object") return;
@@ -108,13 +109,11 @@ function removeUnsupportedKeywords(obj, keywords) {
removeUnsupportedKeywords(item, keywords);
}
} else {
// Delete unsupported keys at current level
for (const keyword of keywords) {
if (keyword in obj) {
delete obj[keyword];
for (const key of Object.keys(obj)) {
if (keywords.includes(key) || key.startsWith("x-")) {
delete obj[key];
}
}
// Recurse into remaining values
for (const value of Object.values(obj)) {
if (value && typeof value === "object") {
removeUnsupportedKeywords(value, keywords);

View File

@@ -415,8 +415,8 @@ export function openaiResponsesToOpenAIResponse(chunk, state) {
return null;
}
// Function call started
if (eventType === "response.output_item.added" && data.item?.type === "function_call") {
// Function call started (standard function_call or custom_tool_call)
if (eventType === "response.output_item.added" && (data.item?.type === "function_call" || data.item?.type === "custom_tool_call")) {
const item = data.item;
state.currentToolCallId = item.call_id || `call_${Date.now()}`;
@@ -443,8 +443,8 @@ export function openaiResponsesToOpenAIResponse(chunk, state) {
};
}
// Function call arguments delta
if (eventType === "response.function_call_arguments.delta") {
// Function call arguments delta (standard or custom_tool_call variant)
if (eventType === "response.function_call_arguments.delta" || eventType === "response.custom_tool_call_input.delta") {
const argsDelta = data.delta || "";
if (!argsDelta) return null;
@@ -466,8 +466,8 @@ export function openaiResponsesToOpenAIResponse(chunk, state) {
};
}
// Function call done
if (eventType === "response.output_item.done" && data.item?.type === "function_call") {
// Function call done (standard or custom_tool_call variant)
if (eventType === "response.output_item.done" && (data.item?.type === "function_call" || data.item?.type === "custom_tool_call")) {
state.toolCallIndex++;
return null;
}