(host: SlashCommandHost, selectedValue: string = host.state.appState.model)
| 358 | } |
| 359 | |
| 360 | export function showModelPicker(host: SlashCommandHost, selectedValue: string = host.state.appState.model): void { |
| 361 | const entries = Object.entries(host.state.appState.availableModels); |
| 362 | if (entries.length === 0) { |
| 363 | host.showNotice( |
| 364 | 'No models configured', |
| 365 | 'Run /login to sign in to Kimi, or /provider to add another provider from a model catalog.', |
| 366 | ); |
| 367 | return; |
| 368 | } |
| 369 | host.mountEditorReplacement( |
| 370 | new TabbedModelSelectorComponent({ |
| 371 | models: host.state.appState.availableModels, |
| 372 | currentValue: host.state.appState.model, |
| 373 | selectedValue, |
| 374 | currentThinkingEffort: host.state.appState.thinkingEffort, |
| 375 | onSelect: ({ alias, thinking }) => { |
| 376 | host.restoreEditor(); |
| 377 | void performModelSwitch(host, alias, thinking, true); |
| 378 | }, |
| 379 | onSessionOnlySelect: ({ alias, thinking }) => { |
| 380 | host.restoreEditor(); |
| 381 | void performModelSwitch(host, alias, thinking, false); |
| 382 | }, |
| 383 | onCancel: () => { |
| 384 | host.restoreEditor(); |
| 385 | }, |
| 386 | }), |
| 387 | ); |
| 388 | } |
| 389 | |
| 390 | async function performModelSwitch( |
| 391 | host: SlashCommandHost, |
no test coverage detected