feat: support openai format enable deepseek v3.1 thinking

This commit is contained in:
suziheng 2025-09-15 14:43:19 +08:00
parent cf0ce425e6
commit 04de01c798
3 changed files with 9 additions and 0 deletions

View File

@ -36,6 +36,12 @@ func ConvertRequest(request model.GeneralOpenAIRequest) *ChatRequest {
enableSearch = true
aliModel = strings.TrimSuffix(aliModel, EnableSearchModelSuffix)
}
enableThinking := false
if request.ReasoningEffort != nil {
enableThinking = true
}
request.TopP = helper.Float64PtrMax(request.TopP, 0.9999)
return &ChatRequest{
Model: aliModel,
@ -52,6 +58,7 @@ func ConvertRequest(request model.GeneralOpenAIRequest) *ChatRequest {
TopK: request.TopK,
ResultFormat: "message",
Tools: request.Tools,
EnableThinking: enableThinking,
},
}
}

View File

@ -25,6 +25,7 @@ type Parameters struct {
Temperature *float64 `json:"temperature,omitempty"`
ResultFormat string `json:"result_format,omitempty"`
Tools []model.Tool `json:"tools,omitempty"`
EnableThinking bool `json:"enable_thinking,omitempty"`
}
type ChatRequest struct {

View File

@ -17,4 +17,5 @@ var ModelList = []string{
"deepseek-r1",
"deepseek-v3",
"deepseek-v3.1",
}