mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 09:21:35 +07:00
fix(web-search): restore build after plugin rebase
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
} from "./web-shared.js";
|
||||
|
||||
const SEARCH_PROVIDERS = ["brave", "gemini", "grok", "kimi", "perplexity"] as const;
|
||||
type SearchProvider = (typeof SEARCH_PROVIDERS)[number];
|
||||
const DEFAULT_SEARCH_COUNT = 5;
|
||||
const MAX_SEARCH_COUNT = 10;
|
||||
|
||||
@@ -614,6 +615,10 @@ function missingSearchKeyPayload(provider: (typeof SEARCH_PROVIDERS)[number]) {
|
||||
};
|
||||
}
|
||||
|
||||
function isSearchProvider(value: string): value is SearchProvider {
|
||||
return SEARCH_PROVIDERS.includes(value as SearchProvider);
|
||||
}
|
||||
|
||||
function resolveSearchProvider(search?: WebSearchConfig): (typeof SEARCH_PROVIDERS)[number] {
|
||||
const raw =
|
||||
search && "provider" in search && typeof search.provider === "string"
|
||||
@@ -1911,10 +1916,12 @@ export function createWebSearchTool(options?: {
|
||||
return null;
|
||||
}
|
||||
|
||||
const runtimeProviderCandidate =
|
||||
options?.runtimeWebSearch?.selectedProvider ?? options?.runtimeWebSearch?.providerConfigured;
|
||||
const provider =
|
||||
options?.runtimeWebSearch?.selectedProvider ??
|
||||
options?.runtimeWebSearch?.providerConfigured ??
|
||||
resolveSearchProvider(search);
|
||||
runtimeProviderCandidate && isSearchProvider(runtimeProviderCandidate)
|
||||
? runtimeProviderCandidate
|
||||
: resolveSearchProvider(search);
|
||||
const perplexityConfig = resolvePerplexityConfig(search);
|
||||
const perplexitySchemaTransportHint =
|
||||
options?.runtimeWebSearch?.perplexityTransport ??
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { PluginEntryConfig } from "../config/types.plugins.js";
|
||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { loadOpenClawPlugins, type PluginLoadOptions } from "./loader.js";
|
||||
import { createPluginLoaderLogger } from "./logger.js";
|
||||
@@ -48,7 +49,7 @@ function withBundledWebSearchEnablementCompat(
|
||||
): PluginLoadOptions["config"] {
|
||||
const existingEntries = config?.plugins?.entries ?? {};
|
||||
let changed = false;
|
||||
const nextEntries: Record<string, unknown> = { ...existingEntries };
|
||||
const nextEntries: Record<string, PluginEntryConfig> = { ...existingEntries };
|
||||
|
||||
for (const pluginId of BUNDLED_WEB_SEARCH_ALLOWLIST_COMPAT_PLUGIN_IDS) {
|
||||
if (existingEntries[pluginId] !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user