MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / runModelSelector

Function runModelSelector

apps/kimi-code/src/tui/commands/prompts.ts:202–226  ·  view source on GitHub ↗
(
  host: SlashCommandHost,
  modelDict: Record<string, ModelAlias>,
)

Source from the content-addressed store, hash-verified

200}
201
202export function runModelSelector(
203 host: SlashCommandHost,
204 modelDict: Record<string, ModelAlias>,
205): Promise<{ alias: string; thinking: ThinkingEffort } | undefined> {
206 return new Promise((resolve) => {
207 const firstAlias = Object.keys(modelDict)[0] ?? '';
208 const caps = modelDict[firstAlias]?.capabilities ?? [];
209 const initialThinking = caps.includes('always_thinking') || caps.includes('thinking');
210 const selector = new ModelSelectorComponent({
211 models: modelDict,
212 currentValue: firstAlias,
213 currentThinkingEffort: initialThinking ? 'on' : 'off',
214 searchable: true,
215 onSelect: ({ alias, thinking }) => {
216 host.restoreEditor();
217 resolve({ alias, thinking });
218 },
219 onCancel: () => {
220 host.restoreEditor();
221 resolve(undefined);
222 },
223 });
224 host.mountEditorReplacement(selector);
225 });
226}

Calls 4

keysMethod · 0.80
restoreEditorMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected