route-claudecode
Version:
Advanced routing and transformation system for Claude Code outputs to multiple AI providers
52 lines • 1.45 kB
TypeScript
/**
* OpenAI Buffered Response Processor
* 完全缓冲式处理:类似CodeWhisperer的processBufferedResponse
* 专门解决多个工具调用被合并为文本的问题
*/
export interface OpenAIBufferedResponse {
content: Array<{
type: 'text' | 'tool_use';
text?: string;
id?: string;
name?: string;
input?: any;
}>;
usage?: {
input_tokens: number;
output_tokens: number;
};
}
export interface OpenAIEvent {
id?: string;
object?: string;
created?: number;
model?: string;
choices?: Array<{
index: number;
delta?: {
role?: string;
content?: string;
tool_calls?: Array<{
index: number;
id?: string;
type?: string;
function?: {
name?: string;
arguments?: string;
};
}>;
};
finish_reason?: string;
}>;
usage?: {
prompt_tokens?: number;
completion_tokens?: number;
total_tokens?: number;
};
}
/**
* 完全缓冲式处理OpenAI响应:先收集所有事件,再统一处理,最后转换为流式格式
* 解决工具调用分段问题
*/
export declare function processOpenAIBufferedResponse(allEvents: OpenAIEvent[], requestId: string, modelName: string): any[];
//# sourceMappingURL=buffered-processor.d.ts.map