fix: add missing await for async functions after sync-to-async migration
- getOAuthTokenFromOpenClaw: make async to properly await readAuthProfiles - secure-storage: add await for getActiveOpenClawProviders call - ipc-handlers: add await for updateAgentModelProvider in OAuth flow Co-authored-by: Haze <hazeone@users.noreply.github.com>
This commit is contained in:
@@ -1192,7 +1192,7 @@ function registerProviderHandlers(gatewayManager: GatewayManager): void {
|
||||
// authHeader immediately, without waiting for Gateway to sync openclaw.json.
|
||||
try {
|
||||
const defaultModelId = provider.model?.split('/').pop();
|
||||
updateAgentModelProvider(targetProviderKey, {
|
||||
await updateAgentModelProvider(targetProviderKey, {
|
||||
baseUrl,
|
||||
api,
|
||||
authHeader: targetProviderKey === 'minimax-portal' ? true : undefined,
|
||||
|
||||
@@ -181,12 +181,12 @@ export async function saveOAuthTokenToOpenClaw(
|
||||
* @param agentId - Optional single agent ID to read from, defaults to 'main'
|
||||
* @returns The OAuth token access string or null if not found
|
||||
*/
|
||||
export function getOAuthTokenFromOpenClaw(
|
||||
export async function getOAuthTokenFromOpenClaw(
|
||||
provider: string,
|
||||
agentId = 'main'
|
||||
): string | null {
|
||||
): Promise<string | null> {
|
||||
try {
|
||||
const store = readAuthProfiles(agentId);
|
||||
const store = await readAuthProfiles(agentId);
|
||||
const profileId = `${provider}:default`;
|
||||
const profile = store.profiles[profileId];
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ export async function getAllProvidersWithKeyInfo(): Promise<
|
||||
> {
|
||||
const providers = await getAllProviders();
|
||||
const results: Array<ProviderConfig & { hasKey: boolean; keyMasked: string | null }> = [];
|
||||
const activeOpenClawProviders = getActiveOpenClawProviders();
|
||||
const activeOpenClawProviders = await getActiveOpenClawProviders();
|
||||
|
||||
// We need to avoid deleting native ones like 'anthropic' or 'google'
|
||||
// that don't need to exist in openclaw.json models.providers
|
||||
|
||||
Reference in New Issue
Block a user