mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 03:21:57 +02:00
refactor: dedupe web fetch runtime config reader
This commit is contained in:
@@ -30,10 +30,6 @@ export type ResolveWebFetchDefinitionParams = {
|
||||
preferRuntimeProviders?: boolean;
|
||||
};
|
||||
|
||||
function resolveFetchConfig(cfg?: OpenClawConfig): WebFetchConfig {
|
||||
return resolveWebProviderConfig<"fetch", NonNullable<WebFetchConfig>>(cfg, "fetch");
|
||||
}
|
||||
|
||||
export function resolveWebFetchEnabled(params: {
|
||||
fetch?: WebFetchConfig;
|
||||
sandboxed?: boolean;
|
||||
@@ -130,7 +126,10 @@ export function resolveWebFetchProviderId(params: {
|
||||
export function resolveWebFetchDefinition(
|
||||
options?: ResolveWebFetchDefinitionParams,
|
||||
): { provider: PluginWebFetchProviderEntry; definition: WebFetchProviderToolDefinition } | null {
|
||||
const fetch = resolveFetchConfig(options?.config);
|
||||
const fetch = resolveWebProviderConfig<"fetch", NonNullable<WebFetchConfig>>(
|
||||
options?.config,
|
||||
"fetch",
|
||||
);
|
||||
const runtimeWebFetch = options?.runtimeWebFetch ?? getActiveRuntimeWebToolsMetadata()?.fetch;
|
||||
const providers = sortWebFetchProvidersForAutoDetect(
|
||||
resolvePluginWebFetchProviders({
|
||||
|
||||
Reference in New Issue
Block a user