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