(host: SlashCommandHost)
| 298 | } |
| 299 | |
| 300 | async 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 | |
| 315 | async function withTimeout<T>(promise: Promise<T>, timeoutMs: number): Promise<T | undefined> { |
| 316 | let timeout: ReturnType<typeof setTimeout> | undefined; |
no test coverage detected