|
1 | 1 | import { |
2 | | -createWebSearchProviderContractFields, |
3 | 2 | type WebSearchProviderPlugin, |
4 | 3 | type WebSearchProviderSetupContext, |
5 | 4 | } from "openclaw/plugin-sdk/provider-web-search-config-contract"; |
| 5 | +import { buildXaiWebSearchProviderBase } from "./web-search-provider-shared.js"; |
6 | 6 | |
7 | | -const XAI_CREDENTIAL_PATH = "plugins.entries.xai.config.webSearch.apiKey"; |
8 | 7 | type XaiWebSearchProviderRuntime = typeof import("./src/web-search-provider.runtime.js"); |
9 | 8 | |
10 | 9 | let xaiWebSearchProviderRuntimePromise: Promise<XaiWebSearchProviderRuntime> | undefined; |
@@ -37,23 +36,7 @@ async function runXaiSearchProviderSetup(
|
37 | 36 | |
38 | 37 | export function createXaiWebSearchProvider(): WebSearchProviderPlugin { |
39 | 38 | return { |
40 | | -id: "grok", |
41 | | -label: "Grok (xAI)", |
42 | | -hint: "Uses xAI OAuth or API key · xAI web-grounded responses", |
43 | | -onboardingScopes: ["text-inference"], |
44 | | -credentialLabel: "xAI API key", |
45 | | -envVars: ["XAI_API_KEY"], |
46 | | -authProviderId: "xai", |
47 | | -placeholder: "xai-...", |
48 | | -signupUrl: "https://console.x.ai/", |
49 | | -docsUrl: "https://docs.openclaw.ai/tools/web", |
50 | | -autoDetectOrder: 30, |
51 | | -credentialPath: XAI_CREDENTIAL_PATH, |
52 | | - ...createWebSearchProviderContractFields({ |
53 | | -credentialPath: XAI_CREDENTIAL_PATH, |
54 | | -searchCredential: { type: "scoped", scopeId: "grok" }, |
55 | | -configuredCredential: { pluginId: "xai" }, |
56 | | -}), |
| 39 | + ...buildXaiWebSearchProviderBase(), |
57 | 40 | runSetup: runXaiSearchProviderSetup, |
58 | 41 | createTool: (ctx) => ({ |
59 | 42 | description: |
|