fix(openai): 修复 service_tier 类型断言问题

groq 有不同的 service tier 配置,不符合 openai 接口类型,因此需要显式类型断言
This commit is contained in:
icarus 2025-08-06 19:23:03 +08:00
parent 936f81392d
commit 5e5e4ac7d5

View File

@ -15,6 +15,7 @@ import {
MCPTool,
MCPToolResponse,
Model,
OpenAIServiceTier,
Provider,
ToolCallResponse,
WebSearchSource
@ -448,7 +449,8 @@ export class OpenAIResponseAPIClient extends OpenAIBaseClient<
max_output_tokens: maxTokens,
stream: streamOutput,
tools: !isEmpty(tools) ? tools : undefined,
service_tier: this.getServiceTier(model),
// groq 有不同的 service tier 配置,不符合 openai 接口类型
service_tier: this.getServiceTier(model) as OpenAIServiceTier,
...(this.getReasoningEffort(assistant, model) as OpenAI.Reasoning),
// 只在对话场景下应用自定义参数,避免影响翻译、总结等其他业务逻辑
...(coreRequest.callType === 'chat' ? this.getCustomParameters(assistant) : {})