mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 05:40:22 +00:00
refactor(xai): move bundled xai runtime into plugin
Co-authored-by: Harold Hunt <harold@pwrdrvr.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { normalizeResolvedSecretInputString } from "../config/types.secrets.js";
|
||||
import { normalizeSecretInputString, resolveSecretInputRef } from "../config/types.secrets.js";
|
||||
import { logVerbose } from "../globals.js";
|
||||
import type {
|
||||
PluginWebSearchProviderEntry,
|
||||
@@ -86,12 +86,18 @@ function hasEntryCredential(
|
||||
const rawValue =
|
||||
provider.getConfiguredCredentialValue?.(config) ??
|
||||
provider.getCredentialValue(search as Record<string, unknown> | undefined);
|
||||
const fromConfig = normalizeSecretInput(
|
||||
normalizeResolvedSecretInputString({
|
||||
value: rawValue,
|
||||
path: provider.credentialPath,
|
||||
}),
|
||||
);
|
||||
const configuredRef = resolveSecretInputRef({
|
||||
value: rawValue,
|
||||
}).ref;
|
||||
if (configuredRef && configuredRef.source !== "env") {
|
||||
return true;
|
||||
}
|
||||
const fromConfig = normalizeSecretInput(normalizeSecretInputString(rawValue));
|
||||
if (configuredRef?.source === "env") {
|
||||
return Boolean(
|
||||
normalizeSecretInput(process.env[configuredRef.id]) || readProviderEnvValue(provider.envVars),
|
||||
);
|
||||
}
|
||||
return Boolean(fromConfig || readProviderEnvValue(provider.envVars));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user