feat: complete v0.3.1 agent workflow
This commit is contained in:
+12
-10
@@ -62,10 +62,11 @@ type rawConfig struct {
|
||||
}
|
||||
|
||||
type rawProviderConfig struct {
|
||||
APIType string `yaml:"api_type"`
|
||||
BaseURL string `yaml:"base_url"`
|
||||
Models []rawModelConfig `yaml:"models"`
|
||||
APIKey string `yaml:"api_key"`
|
||||
APIType string `yaml:"api_type"`
|
||||
BaseURL string `yaml:"base_url"`
|
||||
Models []rawModelConfig `yaml:"models"`
|
||||
APIKey string `yaml:"api_key"`
|
||||
ThinkingParam string `yaml:"thinking_param"`
|
||||
}
|
||||
|
||||
type rawModelConfig struct {
|
||||
@@ -229,12 +230,13 @@ func normalizeProviders(raw rawConfig) map[string]ProviderConfig {
|
||||
func normalizeProvider(name string, raw rawProviderConfig) ProviderConfig {
|
||||
models, modelConfigs := normalizeModelConfigs(raw.Models)
|
||||
provider := ProviderConfig{
|
||||
Name: name,
|
||||
APIType: normalizeAPIType(raw.APIType),
|
||||
BaseURL: raw.BaseURL,
|
||||
Models: models,
|
||||
ModelConfigs: modelConfigs,
|
||||
APIKey: raw.APIKey,
|
||||
Name: name,
|
||||
APIType: normalizeAPIType(raw.APIType),
|
||||
BaseURL: raw.BaseURL,
|
||||
Models: models,
|
||||
ModelConfigs: modelConfigs,
|
||||
APIKey: raw.APIKey,
|
||||
ThinkingParam: strings.TrimSpace(raw.ThinkingParam),
|
||||
}
|
||||
if len(provider.Models) > 0 {
|
||||
provider.Model = provider.Models[0]
|
||||
|
||||
@@ -477,3 +477,28 @@ providers:
|
||||
t.Fatalf("responses thinking param = %q, want %q", got, "reasoning")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadCustomThinkingParam(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
path := filepath.Join(dir, "agentu.yaml")
|
||||
if err := os.WriteFile(path, []byte(`
|
||||
providers:
|
||||
custom:
|
||||
api_type: chat
|
||||
base_url: https://example.com
|
||||
api_key: sk-test
|
||||
thinking_param: reasoning_effort
|
||||
models:
|
||||
- id: custom-model
|
||||
thinking: high
|
||||
`), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cfg, err := Load(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := cfg.Providers["custom"].ThinkingParam; got != "reasoning_effort" {
|
||||
t.Fatalf("thinking param = %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user