mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 22:22:14 +00:00
refactor: dedupe web fetch runtime config reader
This commit is contained in:
parent
e2c41df0b9
commit
7928da0f48
1 changed files with 4 additions and 5 deletions
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue