fix route grouping and codex websocket regressions

This commit is contained in:
cita
2026-03-18 20:38:01 +08:00
parent 332007d4fb
commit f769f43909
38 changed files with 2453 additions and 636 deletions
@@ -217,7 +217,13 @@ export function buildResponsesCompatibilityBodies(
if (instructions !== null) richCandidate.instructions = instructions;
const passthroughFields = [
'parallel_tool_calls',
'include',
'reasoning',
'previous_response_id',
'truncation',
'text',
'service_tier',
'safety_identifier',
'max_tool_calls',
'prompt_cache_key',
@@ -853,6 +853,7 @@ describe('convertResponsesBodyToOpenAiBody', () => {
model: 'gpt-5',
input: 'hello',
stream: true,
parallel_tool_calls: true,
include: ['reasoning.encrypted_content'],
reasoning: {
effort: 'high',
@@ -864,12 +865,20 @@ describe('convertResponsesBodyToOpenAiBody', () => {
prompt_cache_retention: { scope: 'workspace' },
background: true,
top_logprobs: 2,
previous_response_id: 'resp_prev_9',
truncation: 'auto',
service_tier: 'priority',
text: {
verbosity: 'high',
},
});
expect(candidates).toContainEqual({
model: 'gpt-5',
input: 'hello',
stream: true,
parallel_tool_calls: true,
include: ['reasoning.encrypted_content'],
reasoning: {
effort: 'high',
summary: 'auto',
@@ -880,6 +889,12 @@ describe('convertResponsesBodyToOpenAiBody', () => {
prompt_cache_retention: { scope: 'workspace' },
background: true,
top_logprobs: 2,
previous_response_id: 'resp_prev_9',
truncation: 'auto',
service_tier: 'priority',
text: {
verbosity: 'high',
},
});
});
@@ -21,6 +21,7 @@ type ResponsesProxyStreamResult = {
type ResponsesProxyStreamSessionInput = {
modelName: string;
successfulUpstreamPath: string;
strictTerminalEvents?: boolean;
getUsage: () => {
promptTokens: number;
completionTokens: number;
@@ -84,6 +85,14 @@ export function createResponsesProxyStreamSession(input: ResponsesProxyStreamSes
const closeOut = () => {
if (finalized) return;
if (input.strictTerminalEvents) {
finalized = true;
terminalResult = {
status: 'failed',
errorMessage: 'stream closed before response.completed',
};
return;
}
finalize();
};