mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:40:44 +00:00
fix(plugin-sdk): fall back for provider auth runtime
This commit is contained in:
@@ -8,6 +8,7 @@ import path from "node:path";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import { ensureAuthProfileStoreForLocalUpdate } from "../agents/auth-profiles/store.js";
|
||||
import type { OAuthCredential } from "../agents/auth-profiles/types.js";
|
||||
import { resolveApiKeyForProvider as resolveModelApiKeyForProvider } from "../agents/model-auth.js";
|
||||
import { writePrivateSecretFileAtomic } from "../infra/secret-file.js";
|
||||
|
||||
export { resolveEnvApiKey } from "../agents/model-auth-env.js";
|
||||
@@ -438,7 +439,11 @@ async function loadRuntimeModelAuthModule(): Promise<RuntimeModelAuthModule> {
|
||||
export async function resolveApiKeyForProvider(
|
||||
params: Parameters<ResolveApiKeyForProvider>[0],
|
||||
): Promise<Awaited<ReturnType<ResolveApiKeyForProvider>>> {
|
||||
const { resolveApiKeyForProvider } = await loadRuntimeModelAuthModule();
|
||||
const runtimeAuth = await loadRuntimeModelAuthModule();
|
||||
const resolveApiKeyForProvider =
|
||||
typeof runtimeAuth.resolveApiKeyForProvider === "function"
|
||||
? runtimeAuth.resolveApiKeyForProvider
|
||||
: resolveModelApiKeyForProvider;
|
||||
return resolveApiKeyForProvider(params);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user