mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-16 11:41:08 +00:00
35 lines
1.4 KiB
TypeScript
35 lines
1.4 KiB
TypeScript
import {
|
|
getScopedCredentialValue,
|
|
resolveProviderWebSearchPluginConfig,
|
|
setProviderWebSearchPluginConfigValue,
|
|
setScopedCredentialValue,
|
|
type WebSearchProviderPlugin,
|
|
} from "openclaw/plugin-sdk/provider-web-search-contract";
|
|
|
|
export function createXaiWebSearchProvider(): WebSearchProviderPlugin {
|
|
return {
|
|
id: "grok",
|
|
label: "Grok (xAI)",
|
|
hint: "Requires xAI API key · xAI web-grounded responses",
|
|
onboardingScopes: ["text-inference"],
|
|
credentialLabel: "xAI API key",
|
|
envVars: ["XAI_API_KEY"],
|
|
placeholder: "xai-...",
|
|
signupUrl: "https://console.x.ai/",
|
|
docsUrl: "https://docs.openclaw.ai/tools/web",
|
|
autoDetectOrder: 30,
|
|
credentialPath: "plugins.entries.xai.config.webSearch.apiKey",
|
|
inactiveSecretPaths: ["plugins.entries.xai.config.webSearch.apiKey"],
|
|
getCredentialValue: (searchConfig?: Record<string, unknown>) =>
|
|
getScopedCredentialValue(searchConfig, "grok"),
|
|
setCredentialValue: (searchConfigTarget: Record<string, unknown>, value: unknown) =>
|
|
setScopedCredentialValue(searchConfigTarget, "grok", value),
|
|
getConfiguredCredentialValue: (config) =>
|
|
resolveProviderWebSearchPluginConfig(config, "xai")?.apiKey,
|
|
setConfiguredCredentialValue: (configTarget, value) => {
|
|
setProviderWebSearchPluginConfigValue(configTarget, "xai", "apiKey", value);
|
|
},
|
|
createTool: () => null,
|
|
};
|
|
}
|