fix(agent): keep light routing cooldown coverage after rebase
This commit is contained in:
parent
7c5808d645
commit
d4a19cf53e
3 changed files with 9 additions and 13 deletions
|
|
@ -185,6 +185,10 @@ func NewAgentInstance(
|
||||||
logger.WarnCF("agent", "Routing light model config invalid; routing disabled",
|
logger.WarnCF("agent", "Routing light model config invalid; routing disabled",
|
||||||
map[string]any{"light_model": rc.LightModel, "agent_id": agentID, "error": err.Error()})
|
map[string]any{"light_model": rc.LightModel, "agent_id": agentID, "error": err.Error()})
|
||||||
} else {
|
} else {
|
||||||
|
// Reuse the resolved candidate's canonical provider/model form so
|
||||||
|
// routing init stays aligned with model-list resolution behavior.
|
||||||
|
lightModelCfg.Model = providers.ModelKey(resolved[0].Provider, resolved[0].Model)
|
||||||
|
|
||||||
lp, _, err := providers.CreateProviderFromConfig(lightModelCfg)
|
lp, _, err := providers.CreateProviderFromConfig(lightModelCfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.WarnCF("agent", "Routing light model provider init failed; routing disabled",
|
logger.WarnCF("agent", "Routing light model provider init failed; routing disabled",
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,8 @@ func TestNewAgentInstance_ResolveLightModelPerModelCooldownKeys(t *testing.T) {
|
||||||
ModelName: "light-model",
|
ModelName: "light-model",
|
||||||
Model: " LiteLLM/OpenAI/GPT-4O ",
|
Model: " LiteLLM/OpenAI/GPT-4O ",
|
||||||
CooldownStrategy: "per_model",
|
CooldownStrategy: "per_model",
|
||||||
|
APIBase: "https://litellm.example.invalid/v1",
|
||||||
|
APIKeys: config.SimpleSecureStrings("test-key"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1579,33 +1579,23 @@ func TestProcessMessage_SwitchModelPreservesPerModelCooldownKeys(t *testing.T) {
|
||||||
ModelName: "local",
|
ModelName: "local",
|
||||||
Model: "openai/local-model",
|
Model: "openai/local-model",
|
||||||
APIBase: "https://local.example.invalid/v1",
|
APIBase: "https://local.example.invalid/v1",
|
||||||
|
APIKeys: config.SimpleSecureStrings("test-key"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ModelName: "router-a",
|
ModelName: "router-a",
|
||||||
Model: "litellm/openai/gpt-4o-mini",
|
Model: "litellm/openai/gpt-4o-mini",
|
||||||
APIBase: "https://litellm.example.invalid/v1",
|
APIBase: "https://litellm.example.invalid/v1",
|
||||||
CooldownStrategy: "per-model",
|
CooldownStrategy: "per-model",
|
||||||
|
APIKeys: config.SimpleSecureStrings("test-key"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ModelName: "shared-provider",
|
ModelName: "shared-provider",
|
||||||
Model: "litellm/openai/gpt-4.1",
|
Model: "litellm/openai/gpt-4.1",
|
||||||
APIBase: "https://litellm.example.invalid/v1",
|
APIBase: "https://litellm.example.invalid/v1",
|
||||||
|
APIKeys: config.SimpleSecureStrings("test-key"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
cfg.WithSecurity(&config.SecurityConfig{
|
|
||||||
ModelList: map[string]config.ModelSecurityEntry{
|
|
||||||
"local": {
|
|
||||||
APIKeys: []string{"test-key"},
|
|
||||||
},
|
|
||||||
"router-a": {
|
|
||||||
APIKeys: []string{"test-key"},
|
|
||||||
},
|
|
||||||
"shared-provider": {
|
|
||||||
APIKeys: []string{"test-key"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
msgBus := bus.NewMessageBus()
|
msgBus := bus.NewMessageBus()
|
||||||
provider := &countingMockProvider{response: "LLM reply"}
|
provider := &countingMockProvider{response: "LLM reply"}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue