(provider, apiKey, baseURL string)
| 60 | } |
| 61 | |
| 62 | func resolveAgentAccountInput(provider, apiKey, baseURL string) (resolvedAgentAccountInput, error) { |
| 63 | resolvedAPIKey := strings.TrimSpace(apiKey) |
| 64 | resolvedBaseURL := strings.TrimSpace(baseURL) |
| 65 | if resolvedBaseURL == "" { |
| 66 | if requiresInitialAgentAccountModels(provider) { |
| 67 | return resolvedAgentAccountInput{}, buserr.New("ErrAgentBaseURLRequired") |
| 68 | } |
| 69 | if defaultURL, ok := providercatalog.DefaultBaseURL(provider); ok { |
| 70 | resolvedBaseURL = defaultURL |
| 71 | } |
| 72 | } |
| 73 | if !providercatalog.SkipVerification(provider) { |
| 74 | if err := providercatalog.VerifyAccount(provider, resolvedBaseURL, resolvedAPIKey); err != nil { |
| 75 | return resolvedAgentAccountInput{}, err |
| 76 | } |
| 77 | } |
| 78 | return resolvedAgentAccountInput{ |
| 79 | Provider: provider, |
| 80 | APIKey: resolvedAPIKey, |
| 81 | BaseURL: resolvedBaseURL, |
| 82 | }, nil |
| 83 | } |
| 84 | |
| 85 | func readOpenclawConfig(configPath string) (map[string]interface{}, error) { |
| 86 | if strings.TrimSpace(configPath) == "" { |
no test coverage detected