fix(tui): refresh expired API credentials

This commit is contained in:
chengyongru
2026-08-18 18:19:33 +08:00
committed by chengyongru
parent d47efcc352
commit 467a7b5331
5 changed files with 230 additions and 26 deletions
+7 -1
View File
@@ -7,6 +7,7 @@ import {
import {
fetchRuntimeControls,
type ApiReauthenticator,
type WorkspaceScopePayload,
} from "./protocol"
import { PickerMenu, type PickerMenuTheme } from "./picker-menu"
@@ -29,6 +30,7 @@ interface RuntimeControlsOptions {
modelPreset: string
workspace: string
access: string
reauthenticateApi?: ApiReauthenticator
available: () => boolean
beforeOpen: () => void
refreshScope: () => Promise<void>
@@ -202,7 +204,11 @@ export class RuntimeControls {
return
}
this.controlsPromise = (async () => {
const controls = await fetchRuntimeControls(this.options.apiUrl, this.options.apiToken)
const controls = await fetchRuntimeControls(
this.options.apiUrl,
this.options.apiToken,
this.options.reauthenticateApi,
)
const presets = new Map(controls.modelPresets.map((preset) => [
preset.name.toLocaleLowerCase(),
preset,