fix: avoid sync github credential reads in provider manager (#428)
* fix: avoid sync github credential reads in provider manager * test: stabilize provider manager async credential test * fix: avoid first-frame github provider false negative --------- Co-authored-by: KRATOS <84986124+gnanam1990@users.noreply.github.com>
This commit is contained in:
@@ -23,6 +23,19 @@ export function readGithubModelsToken(): string | undefined {
|
||||
}
|
||||
}
|
||||
|
||||
export async function readGithubModelsTokenAsync(): Promise<string | undefined> {
|
||||
if (isBareMode()) return undefined
|
||||
try {
|
||||
const data = (await getSecureStorage().readAsync()) as
|
||||
| ({ githubModels?: GithubModelsCredentialBlob } & Record<string, unknown>)
|
||||
| null
|
||||
const t = data?.githubModels?.accessToken?.trim()
|
||||
return t || undefined
|
||||
} catch {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If GitHub Models mode is on and no token is in the environment, copy the
|
||||
* stored token into process.env so the OpenAI shim and validation see it.
|
||||
|
||||
Reference in New Issue
Block a user