MCPcopy Create free account
hub / github.com/betta-tech/byo-coding-agent / cmdProvider

Function cmdProvider

commands.go:169–198  ·  view source on GitHub ↗
(args string)

Source from the content-addressed store, hash-verified

167}
168
169func cmdProvider(args string) {
170 if args == "" {
171 fmt.Printf("current: %s %s\n",
172 ui.Cyan(ProviderKind(rootAgent.Provider)),
173 ui.Dimmed("(model: "+rootAgent.Provider.Model()+")"))
174 fmt.Println(ui.Dimmed("choices:"))
175 for _, p := range KnownProviders {
176 fmt.Printf(" %s\n", p)
177 }
178 fmt.Println(ui.Dimmed("usage: /provider <name> [model]"))
179 return
180 }
181 // Optional second token = model id to set on the new provider.
182 parts := strings.Fields(args)
183 name := parts[0]
184 model := ""
185 if len(parts) > 1 {
186 model = parts[1]
187 }
188 if err := switchProvider(name, model); err != nil {
189 fmt.Printf("provider: %v\n", err)
190 return
191 }
192 fmt.Printf("provider: %s %s\n",
193 ui.Cyan(ProviderKind(rootAgent.Provider)),
194 ui.Dimmed("(model: "+rootAgent.Provider.Model()+")"))
195 if !apiKeySet(name) {
196 fmt.Println(ui.Dimmed("warning: " + apiKeyEnv(name) + " is not set; the next call will fail"))
197 }
198}
199
200func apiKeySet(provider string) bool {
201 return os.Getenv(apiKeyEnv(provider)) != ""

Callers

nothing calls this directly

Calls 7

CyanFunction · 0.92
DimmedFunction · 0.92
ProviderKindFunction · 0.85
switchProviderFunction · 0.85
apiKeySetFunction · 0.85
apiKeyEnvFunction · 0.85
ModelMethod · 0.65

Tested by

no test coverage detected