agent fix
This commit is contained in:
@@ -41,14 +41,25 @@ import (
|
||||
func liveChat(t *testing.T) (utils.Chat, string) {
|
||||
t.Helper()
|
||||
|
||||
// Provider defaults exactly as production does, so this exercises the
|
||||
// defaulting rather than working around it. The first version read the
|
||||
// variable straight and skipped silently the moment `ASSISTANT_PROVIDER`
|
||||
// was left unset — which is precisely the configuration this is meant to
|
||||
// prove works.
|
||||
provider := strings.ToLower(strings.TrimSpace(os.Getenv("ASSISTANT_PROVIDER")))
|
||||
model := os.Getenv("ASSISTANT_MODEL")
|
||||
if provider == "" && strings.TrimSpace(model) != "" {
|
||||
provider = "openai"
|
||||
}
|
||||
|
||||
cfg := config.AssistantConfig{
|
||||
Provider: strings.ToLower(strings.TrimSpace(os.Getenv("ASSISTANT_PROVIDER"))),
|
||||
Provider: provider,
|
||||
BaseURL: os.Getenv("ASSISTANT_BASE_URL"),
|
||||
APIKey: os.Getenv("ASSISTANT_API_KEY"),
|
||||
Balanced: os.Getenv("ASSISTANT_MODEL"),
|
||||
Balanced: model,
|
||||
}
|
||||
if cfg.APIKey == "" || !cfg.Enabled() {
|
||||
t.Skip("no ASSISTANT_* provider configured; skipping the live model test")
|
||||
if !cfg.Enabled() {
|
||||
t.Skipf("no model configured, skipping the live test: %s", cfg.Why())
|
||||
}
|
||||
|
||||
chat, err := utils.NewChat(cfg)
|
||||
|
||||
Reference in New Issue
Block a user