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

Function refreshModelsForPicker

apps/kimi-code/src/tui/commands/config.ts:300–313  ·  view source on GitHub ↗
(host: SlashCommandHost)

Source from the content-addressed store, hash-verified

298}
299
300async function refreshModelsForPicker(host: SlashCommandHost): Promise<void> {
301 try {
302 const result = await withTimeout(
303 host.authFlow.refreshOAuthProviderModels(),
304 MODEL_PICKER_REFRESH_TIMEOUT_MS,
305 );
306 if (result === undefined) return;
307 for (const f of result.failed) {
308 host.showStatus(`Skipped refreshing ${f.provider}: ${f.reason}`, 'warning');
309 }
310 } catch (error) {
311 host.showStatus(`Skipped refreshing models: ${formatErrorMessage(error)}`, 'warning');
312 }
313}
314
315async function withTimeout<T>(promise: Promise<T>, timeoutMs: number): Promise<T | undefined> {
316 let timeout: ReturnType<typeof setTimeout> | undefined;

Callers 1

handleModelCommandFunction · 0.85

Calls 4

formatErrorMessageFunction · 0.90
withTimeoutFunction · 0.70
showStatusMethod · 0.65

Tested by

no test coverage detected