feat(models): 注册 Kimi K3 和 Qwen3.8
This commit is contained in:
@@ -78,6 +78,15 @@ func applyAliyunReasoning(body map[string]any, candidate store.RuntimeModelCandi
|
||||
|
||||
body["enable_thinking"] = true
|
||||
model := chatReasoningModelName(body, candidate)
|
||||
if isAliyunQwen38MaxPreview(model) {
|
||||
if budget, ok := positiveIntFromAny(body["thinking_budget_tokens"]); ok {
|
||||
body["thinking_budget"] = budget
|
||||
delete(body, "reasoning_effort")
|
||||
return
|
||||
}
|
||||
body["reasoning_effort"] = qwen38MaxPreviewReasoningEffort(effort)
|
||||
return
|
||||
}
|
||||
if isAliyunHighMaxReasoningModel(model) {
|
||||
body["reasoning_effort"] = highMaxReasoningEffort(effort)
|
||||
return
|
||||
@@ -200,6 +209,10 @@ func isAliyunHighMaxReasoningModel(model string) bool {
|
||||
return strings.Contains(model, "deepseek-v4") || strings.HasPrefix(model, "glm-")
|
||||
}
|
||||
|
||||
func isAliyunQwen38MaxPreview(model string) bool {
|
||||
return strings.Contains(model, "qwen3.8-max-preview")
|
||||
}
|
||||
|
||||
func isAliyunThinkingBudgetModel(model string) bool {
|
||||
return strings.Contains(model, "qwen") || strings.Contains(model, "qwq") || strings.Contains(model, "qvq") || strings.Contains(model, "kimi")
|
||||
}
|
||||
@@ -219,6 +232,17 @@ func highMaxReasoningEffort(effort string) string {
|
||||
return "high"
|
||||
}
|
||||
|
||||
func qwen38MaxPreviewReasoningEffort(effort string) string {
|
||||
switch effort {
|
||||
case "low", "minimal":
|
||||
return "low"
|
||||
case "medium":
|
||||
return "medium"
|
||||
default:
|
||||
return "xhigh"
|
||||
}
|
||||
}
|
||||
|
||||
func zhipuReasoningEffort(effort string) string {
|
||||
if effort == "max" {
|
||||
return "xhigh"
|
||||
|
||||
@@ -529,6 +529,36 @@ func TestOpenAIClientChatReasoningParamsByProvider(t *testing.T) {
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "aliyun qwen 3.8 preview preserves supported effort",
|
||||
provider: "aliyun-bailian-openai",
|
||||
model: "qwen3.8-max-preview",
|
||||
body: map[string]any{
|
||||
"reasoning_effort": "high",
|
||||
},
|
||||
assertion: func(t *testing.T, body map[string]any) {
|
||||
if body["enable_thinking"] != true || body["reasoning_effort"] != "xhigh" {
|
||||
t.Fatalf("aliyun qwen 3.8 should use xhigh reasoning effort, got %+v", body)
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "aliyun qwen 3.8 preview uses explicit budget exclusively",
|
||||
provider: "aliyun-bailian-openai",
|
||||
model: "qwen3.8-max-preview",
|
||||
body: map[string]any{
|
||||
"reasoning_effort": "medium",
|
||||
"thinking_budget_tokens": 16384,
|
||||
},
|
||||
assertion: func(t *testing.T, body map[string]any) {
|
||||
if body["enable_thinking"] != true || body["thinking_budget"] != float64(16384) {
|
||||
t.Fatalf("aliyun qwen 3.8 should use the explicit thinking budget, got %+v", body)
|
||||
}
|
||||
if _, ok := body["reasoning_effort"]; ok {
|
||||
t.Fatalf("aliyun qwen 3.8 must not combine reasoning effort with thinking budget: %+v", body)
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "same deepseek model on aliyun uses aliyun protocol",
|
||||
provider: "aliyun-bailian-openai",
|
||||
|
||||
Reference in New Issue
Block a user