feat: add model routing table with three-layer priority

This commit is contained in:
Mathias Bergqvist
2026-04-17 07:37:43 +02:00
parent 8b8ada2676
commit 4c00b55ca5
3 changed files with 97 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
package config_test
import (
"os"
"path/filepath"
"testing"
"github.com/mathiasbq/supervisor/internal/config"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestModelsResolve(t *testing.T) {
yaml := `
default: ollama/default-model
skills:
tdd: ollama/qwen3-coder-30b-tuned
review: ollama/devstral-tuned
`
f := filepath.Join(t.TempDir(), "models.yaml")
require.NoError(t, os.WriteFile(f, []byte(yaml), 0644))
m, err := config.LoadModels(f)
require.NoError(t, err)
assert.Equal(t, "ollama/qwen3-coder-30b-tuned", m.Resolve("tdd", ""))
assert.Equal(t, "ollama/devstral-tuned", m.Resolve("review", ""))
assert.Equal(t, "ollama/default-model", m.Resolve("unknown", ""))
}
func TestModelsOverride(t *testing.T) {
yaml := `
default: ollama/default-model
skills:
tdd: ollama/qwen3-coder-30b-tuned
`
f := filepath.Join(t.TempDir(), "models.yaml")
require.NoError(t, os.WriteFile(f, []byte(yaml), 0644))
m, err := config.LoadModels(f)
require.NoError(t, err)
assert.Equal(t, "anthropic/claude-sonnet-4-6", m.Resolve("tdd", "anthropic/claude-sonnet-4-6"))
}