mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix: update Codex executor for gpt-5.3-codex support
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
decolua
co-authored by
Cursor
parent
9c9af25acd
commit
d7d5dc90bc
@@ -368,7 +368,7 @@ export function openaiResponsesToOpenAIResponse(chunk, state) {
|
||||
id: state.chatId || `chatcmpl-${Date.now()}`,
|
||||
object: "chat.completion.chunk",
|
||||
created: state.created || Math.floor(Date.now() / 1000),
|
||||
model: state.model || "gpt-4",
|
||||
model: state.model || "unknown",
|
||||
choices: [{
|
||||
index: 0,
|
||||
delta: {},
|
||||
@@ -401,7 +401,7 @@ export function openaiResponsesToOpenAIResponse(chunk, state) {
|
||||
id: state.chatId,
|
||||
object: "chat.completion.chunk",
|
||||
created: state.created,
|
||||
model: state.model || "gpt-4",
|
||||
model: state.model || "unknown",
|
||||
choices: [{
|
||||
index: 0,
|
||||
delta: { content: delta },
|
||||
@@ -424,7 +424,7 @@ export function openaiResponsesToOpenAIResponse(chunk, state) {
|
||||
id: state.chatId,
|
||||
object: "chat.completion.chunk",
|
||||
created: state.created,
|
||||
model: state.model || "gpt-4",
|
||||
model: state.model || "unknown",
|
||||
choices: [{
|
||||
index: 0,
|
||||
delta: {
|
||||
@@ -452,7 +452,7 @@ export function openaiResponsesToOpenAIResponse(chunk, state) {
|
||||
id: state.chatId,
|
||||
object: "chat.completion.chunk",
|
||||
created: state.created,
|
||||
model: state.model || "gpt-4",
|
||||
model: state.model || "unknown",
|
||||
choices: [{
|
||||
index: 0,
|
||||
delta: {
|
||||
@@ -511,7 +511,7 @@ export function openaiResponsesToOpenAIResponse(chunk, state) {
|
||||
id: state.chatId,
|
||||
object: "chat.completion.chunk",
|
||||
created: state.created,
|
||||
model: state.model || "gpt-4",
|
||||
model: state.model || "unknown",
|
||||
choices: [{
|
||||
index: 0,
|
||||
delta: {},
|
||||
@@ -529,6 +529,32 @@ export function openaiResponsesToOpenAIResponse(chunk, state) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Error events from Responses API (e.g. model_not_found)
|
||||
if (eventType === "error" || eventType === "response.failed") {
|
||||
// Avoid emitting duplicate errors (error + response.failed arrive back-to-back)
|
||||
if (state.finishReasonSent) return null;
|
||||
|
||||
const error = data.error || data.response?.error;
|
||||
if (error) {
|
||||
state.error = error;
|
||||
state.finishReasonSent = true;
|
||||
|
||||
// Surface the error as an OpenAI-compatible error chunk
|
||||
return {
|
||||
id: state.chatId || `chatcmpl-${Date.now()}`,
|
||||
object: "chat.completion.chunk",
|
||||
created: state.created || Math.floor(Date.now() / 1000),
|
||||
model: state.model || "unknown",
|
||||
choices: [{
|
||||
index: 0,
|
||||
delta: { content: `[Error] ${error.message || JSON.stringify(error)}` },
|
||||
finish_reason: "stop"
|
||||
}]
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Reasoning events (convert to content or skip)
|
||||
if (eventType === "response.reasoning_summary_text.delta") {
|
||||
// Optionally include reasoning as content, or skip
|
||||
|
||||
Reference in New Issue
Block a user