handleProviderCommand switches the active LLM provider by name — the single-command, navigable counterpart to the numbered /switch picker. Bare it lists the available providers (marking the current one); with an argument it switches to that provider, matched case-insensitively. The palette opens it
(ctx context.Context, input string)
| 294 | // it switches to that provider, matched case-insensitively. The palette opens |
| 295 | // it scoped to the provider list, giving the same shortcut UX as /model. |
| 296 | func (cli *ChatCLI) handleProviderCommand(ctx context.Context, input string) { |
| 297 | available := cli.manager.GetAvailableProviders() |
| 298 | args := strings.Fields(input) |
| 299 | if len(args) < 2 { |
| 300 | fmt.Println(i18n.T("cli.provider.current", cli.Provider)) |
| 301 | for _, p := range available { |
| 302 | marker := " " |
| 303 | if p == cli.Provider { |
| 304 | marker = "→ " |
| 305 | } |
| 306 | fmt.Printf("%s%s\n", marker, p) |
| 307 | } |
| 308 | fmt.Println(i18n.T("cli.provider.hint")) |
| 309 | return |
| 310 | } |
| 311 | requested := args[1] |
| 312 | for _, p := range available { |
| 313 | if strings.EqualFold(p, requested) { |
| 314 | _ = cli.applyProviderSwitch(ctx, p) |
| 315 | return |
| 316 | } |
| 317 | } |
| 318 | fmt.Println(i18n.T("cli.provider.unknown", requested)) |
| 319 | } |
| 320 | |
| 321 | // handleMaxTokensCommand is a shorthand for `/switch --max-tokens <num>`: it |
| 322 | // caps the model's output tokens for the session without the longer flag form. |