fix: pass proxy-aware fetchFn to media understanding providers

runProviderEntry now calls resolveProxyFetchFromEnv() and passes the
result as fetchFn to transcribeAudio/describeVideo, so media provider
API calls respect HTTPS_PROXY/HTTP_PROXY behind corporate proxies.
This commit is contained in:
Marcus Castro
2026-02-28 01:41:32 -03:00
committed by Peter Steinberger
parent ba3fa44c5b
commit 8c1e9949b3
2 changed files with 190 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import type {
MediaUnderstandingModelConfig,
} from "../config/types.tools.js";
import { logVerbose, shouldLogVerbose } from "../globals.js";
import { resolveProxyFetchFromEnv } from "../infra/net/proxy-fetch.js";
import { resolvePreferredOpenClawTmpDir } from "../infra/tmp-openclaw-dir.js";
import { runExec } from "../process/exec.js";
import { MediaAttachmentCache } from "./attachments.js";
@@ -429,6 +430,10 @@ export async function runProviderEntry(params: {
throw new Error(`Media provider not available: ${providerId}`);
}
// Resolve proxy-aware fetch from env vars (HTTPS_PROXY, HTTP_PROXY, etc.)
// so provider HTTP calls are routed through the proxy when configured.
const fetchFn = resolveProxyFetchFromEnv();
if (capability === "audio") {
if (!provider.transcribeAudio) {
throw new Error(`Audio transcription provider "${providerId}" not available.`);
@@ -468,6 +473,7 @@ export async function runProviderEntry(params: {
prompt,
query: providerQuery,
timeoutMs,
fetchFn,
}),
});
return {
@@ -517,6 +523,7 @@ export async function runProviderEntry(params: {
model: entry.model,
prompt,
timeoutMs,
fetchFn,
}),
});
return {