This expands the intelligent routing feature (which previously only supported a binary light/heavy split) to support an arbitrary number of tiers, each with its own model and threshold score. - Update `RoutingConfig` to use a `Tiers` array. - Handle backward compatibility for `light_model` and `threshold`. - Update `Router.SelectModel` to iterate over sorted tiers and select the tier with the highest threshold that is <= the complexity score. - Update `AgentInstance` initialization to resolve candidates for all routing tiers instead of just the light model. - Update the frontend UI to display, add, edit, and remove routing tiers. Co-authored-by: TanLuong <28281768+TanLuong@users.noreply.github.com>
29 lines
923 B
Diff
29 lines
923 B
Diff
<<<<<<< SEARCH
|
|
func TestRouter_SelectModel_SimpleMessageUsesLight(t *testing.T) {
|
|
r := New(RouterConfig{LightModel: "gemini-flash"})
|
|
msg := "hello, how are you?"
|
|
|
|
model, usedLight, _ := r.SelectModel(msg, nil, "claude-sonnet-4-6")
|
|
|
|
if !usedLight {
|
|
t.Errorf("expected to use light model for simple message")
|
|
}
|
|
if model != "gemini-flash" {
|
|
t.Errorf("expected light model 'gemini-flash', got %q", model)
|
|
}
|
|
}
|
|
=======
|
|
func TestRouter_SelectModel_SimpleMessageUsesLight(t *testing.T) {
|
|
r := New(RouterConfig{Tiers: []RoutingTier{{Model: "gemini-flash", Threshold: 0.0}, {Model: "claude-sonnet-4-6", Threshold: 0.35}}})
|
|
msg := "hello, how are you?"
|
|
|
|
model, usedLight, _ := r.SelectModel(msg, nil, "claude-sonnet-4-6")
|
|
|
|
if !usedLight {
|
|
t.Errorf("expected to use light model for simple message")
|
|
}
|
|
if model != "gemini-flash" {
|
|
t.Errorf("expected light model 'gemini-flash', got %q", model)
|
|
}
|
|
}
|
|
>>>>>>> REPLACE
|