/** * ChatPassthroughProxy — Chat Completions 纯透传代理 * * 与 ChatCompletionsProxy 不同,本代理**不修改任何请求/响应数据**: * - 不强制 stream=true * - 不注入 stream_options * - 不设置默认 max_tokens * - 不解析 SSE 内容,不重组 chunk 结构 * * 仅做两件事: * 1. 将客户端原始请求体原样转发到上游 /chat/completions * 2. 通过 fetchWithRetry 实现自动错误重试(50x / 超时 / 连接错误) * * 响应直接以原始字节流写回客户端,保持上游返回的 SSE/JSON 格式完全一致。 */ import { Response } from 'express'; import BaseProxy from './common/BaseProxy'; import type { ChatCompletionsProxyInput, SSECallbacks } from './common/types'; export default class ChatPassthroughProxy extends BaseProxy { private callbacks?; private clientRes?; setCallbacks(callbacks: SSECallbacks): this; setClientResponse(res: Response): this; protected validate(input: ChatCompletionsProxyInput): void; protected optimizeInput(input: ChatCompletionsProxyInput): ChatCompletionsProxyInput; protected transformRequest(input: ChatCompletionsProxyInput): ChatCompletionsProxyInput['body']; protected buildEndpoint(input: ChatCompletionsProxyInput): string; protected proxy(input: ChatCompletionsProxyInput, body: ChatCompletionsProxyInput['body'], endpoint: string): Promise; /** * 执行透传代理 */ execute(input: ChatCompletionsProxyInput, callbacks?: SSECallbacks): Promise; } //# sourceMappingURL=ChatPassthroughProxy.d.ts.map