fix(media): propagate image timeout to providers · openclaw/openclaw@09a64bd
obviyus
·
2026-04-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -938,10 +938,12 @@ function resolveOllamaModelHeaders(model: {
|
938 | 938 | |
939 | 939 | function resolveOllamaRequestTimeoutMs( |
940 | 940 | model: object, |
941 | | -options: { requestTimeoutMs?: unknown } | undefined, |
| 941 | +options: { requestTimeoutMs?: unknown; timeoutMs?: unknown } | undefined, |
942 | 942 | ): number | undefined { |
943 | 943 | const raw = |
944 | | -options?.requestTimeoutMs ?? (model as { requestTimeoutMs?: unknown }).requestTimeoutMs; |
| 944 | +options?.requestTimeoutMs ?? |
| 945 | +options?.timeoutMs ?? |
| 946 | +(model as { requestTimeoutMs?: unknown }).requestTimeoutMs; |
945 | 947 | return typeof raw === "number" && Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : undefined; |
946 | 948 | } |
947 | 949 | |
@@ -1004,7 +1006,7 @@ export function createOllamaStreamFn(
|
1004 | 1006 | policy: ssrfPolicy, |
1005 | 1007 | timeoutMs: resolveOllamaRequestTimeoutMs( |
1006 | 1008 | model, |
1007 | | -options as { requestTimeoutMs?: unknown } | undefined, |
| 1009 | +options as { requestTimeoutMs?: unknown; timeoutMs?: unknown } | undefined, |
1008 | 1010 | ), |
1009 | 1011 | auditContext: "ollama-stream.chat", |
1010 | 1012 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -401,13 +401,15 @@ async function describeImagesWithModelInternal(
|
401 | 401 | const maxTokens = resolveImageToolMaxTokens(model.maxTokens, params.maxTokens ?? 512); |
402 | 402 | const completeImage = async (onPayload?: ProviderStreamOptions["onPayload"]) => { |
403 | 403 | const payloadHandler = composeImageDescriptionPayloadHandlers(onPayload, options.onPayload); |
| 404 | +const timeoutMs = resolveImageDescriptionTimeoutMs(params.timeoutMs, startedAtMs); |
404 | 405 | return await withImageDescriptionTimeout({ |
405 | 406 | controller, |
406 | | -timeoutMs: resolveImageDescriptionTimeoutMs(params.timeoutMs, startedAtMs), |
| 407 | + timeoutMs, |
407 | 408 | task: complete(model, context, { |
408 | 409 | apiKey, |
409 | 410 | maxTokens, |
410 | 411 | signal: controller.signal, |
| 412 | + ...(timeoutMs !== undefined ? { timeoutMs } : {}), |
411 | 413 | ...(payloadHandler ? { onPayload: payloadHandler } : {}), |
412 | 414 | }), |
413 | 415 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。