-
Notifications
You must be signed in to change notification settings - Fork 353
Description
Summary
When a user creates a DashScope provider with a custom name (e.g. myqwen) and then tries to create an agent using that provider, the "Check & Create" step fails with:
provider not registered: myqwen
Root Cause
DashScopeProvider.Name() hardcodes the return value "dashscope" regardless of the name stored in the database:
// internal/providers/dashscope.go
func (p *DashScopeProvider) Name() string { return "dashscope" } // ← hardcodedWhen registerInMemory is called after provider creation, the provider is registered into the in-memory registry under the key "dashscope". However, the verify endpoint (POST /v1/providers/{id}/verify) looks up the registry using p.Name from the DB record (e.g. "myqwen"), which doesn't match → lookup fails.
// internal/http/providers.go — registerInMemory
case store.ProviderDashScope:
h.providerReg.Register(providers.NewDashScopeProvider(p.APIKey, p.APIBase, ""))
// registered as "dashscope", not "myqwen"
// internal/http/provider_verify.go
provider, err := h.providerReg.Get(p.Name) // looks for "myqwen" → not foundThis is inconsistent with OpenAIProvider (used in the default case), which correctly accepts name as the first parameter and returns it from Name().
Workaround
Name the provider exactly dashscope when creating it in the Dashboard. Verification and agent creation will then work correctly.
Proposed Fix
Add a name parameter to [NewDashScopeProvider]goclaw/internal/providers/dashscope.go:20:0-30:1) (like NewOpenAIProvider) and return it from Name(), then pass p.Name from the DB at all call sites in registerInMemory and registerProvidersFromDB.
Affected files