mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
feat(providers): add extra_body config to inject custom fields into request body
Allow configuring provider-specific fields like reasoning_split for minimax via the model config's extra_body map. These fields are merged into the request body last, giving them precedence over default values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1207,6 +1207,9 @@ func TestModelConfig_ExtraBodyRoundTrip(t *testing.T) {
|
||||
ExtraBody: map[string]any{"custom_field": "value", "num_field": 42},
|
||||
},
|
||||
},
|
||||
security: &SecurityConfig{
|
||||
ModelList: map[string]ModelSecurityEntry{"test-model:0": {APIKeys: []string{"sk-test"}}},
|
||||
},
|
||||
}
|
||||
|
||||
if err := SaveConfig(cfgPath, cfg); err != nil {
|
||||
@@ -1228,3 +1231,24 @@ func TestModelConfig_ExtraBodyRoundTrip(t *testing.T) {
|
||||
t.Errorf("ExtraBody[num_field] = %v, want 42", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultConfig_MinimaxExtraBody(t *testing.T) {
|
||||
cfg := DefaultConfig()
|
||||
|
||||
var minimaxCfg *ModelConfig
|
||||
for i := range cfg.ModelList {
|
||||
if cfg.ModelList[i].Model == "minimax/MiniMax-M2.5" {
|
||||
minimaxCfg = cfg.ModelList[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
if minimaxCfg == nil {
|
||||
t.Fatal("Minimax model not found in ModelList")
|
||||
}
|
||||
if minimaxCfg.ExtraBody == nil {
|
||||
t.Fatal("Minimax ExtraBody should not be nil")
|
||||
}
|
||||
if got, ok := minimaxCfg.ExtraBody["reasoning_split"]; !ok || got != true {
|
||||
t.Fatalf("Minimax ExtraBody[reasoning_split] = %v, want true", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user