fix(tui): refresh expired API credentials
This commit is contained in:
1 parent
d47efcc352
commit
467a7b5331
5 files changed
+230
-26
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user