fix: update applyProviderSpecificChatParams to accept pointer and add nil check

test: add unit test for applyProviderSpecificChatParams with DashScope model
This commit is contained in:
mlogclub
2026-06-24 23:26:18 +08:00
parent eb4064bfa9
commit 22c241a4ad
2 changed files with 48 additions and 2 deletions
+5 -2
View File
@@ -59,7 +59,7 @@ func (s *llm) ChatWithConfig(ctx context.Context, config models.AIConfig, system
if config.MaxOutputTokens > 0 {
params.MaxCompletionTokens = openai.Int(int64(config.MaxOutputTokens))
}
applyProviderSpecificChatParams(params, config)
applyProviderSpecificChatParams(&params, config)
client := newOpenAIClient(config)
chatResp, err := client.Chat.Completions.New(ctx, params)
@@ -80,7 +80,10 @@ func (s *llm) ChatWithConfig(ctx context.Context, config models.AIConfig, system
}, nil
}
func applyProviderSpecificChatParams(params openai.ChatCompletionNewParams, config models.AIConfig) {
func applyProviderSpecificChatParams(params *openai.ChatCompletionNewParams, config models.AIConfig) {
if params == nil {
return
}
if isDashScopeQwenThinkingModel(config) {
params.SetExtraFields(map[string]any{
"enable_thinking": false,