























@@ -91,6 +91,23 @@ function isLocalProviderBaseUrl(baseUrl: string): boolean {
9191);
9292}
939394+function isOllamaCloudModel(model: { id?: string; provider?: string } | undefined): boolean {
95+const rawModelId = model?.id;
96+if (typeof rawModelId !== "string") {
97+return false;
98+}
99+100+const provider = model?.provider?.trim().toLowerCase();
101+if (provider && !provider.startsWith("ollama")) {
102+return false;
103+}
104+105+const modelId = rawModelId.trim().toLowerCase();
106+const slashIndex = modelId.indexOf("/");
107+const bareModelId = slashIndex >= 0 ? modelId.slice(slashIndex + 1) : modelId;
108+return bareModelId.endsWith(":cloud");
109+}
110+94111/**
95112 * Resolves the LLM idle timeout from configuration.
96113 * @returns Idle timeout in milliseconds, or 0 to disable
@@ -100,7 +117,7 @@ export function resolveLlmIdleTimeoutMs(params?: {
100117trigger?: EmbeddedRunTrigger;
101118runTimeoutMs?: number;
102119modelRequestTimeoutMs?: number;
103-model?: { baseUrl?: string };
120+model?: { baseUrl?: string; id?: string; provider?: string };
104121}): number {
105122const clampTimeoutMs = (valueMs: number) => Math.min(Math.floor(valueMs), MAX_SAFE_TIMEOUT_MS);
106123const clampImplicitTimeoutMs = (valueMs: number) =>
@@ -156,9 +173,16 @@ export function resolveLlmIdleTimeoutMs(params?: {
156173// Local providers can legitimately stream nothing for many minutes during
157174// prompt evaluation or thinking, so falling back to the default would abort
158175// valid local runs. Honor it only when the user has not opted out via the
159-// baseUrl pointing at loopback / private-network / `.local`.
176+// baseUrl pointing at loopback / private-network / `.local`. Ollama cloud
177+// models are still hosted remotely even when proxied through local Ollama, so
178+// keep the cloud watchdog for `*:cloud` model ids.
160179const baseUrl = params?.model?.baseUrl;
161-if (typeof baseUrl === "string" && baseUrl.length > 0 && isLocalProviderBaseUrl(baseUrl)) {
180+if (
181+typeof baseUrl === "string" &&
182+baseUrl.length > 0 &&
183+isLocalProviderBaseUrl(baseUrl) &&
184+!isOllamaCloudModel(params?.model)
185+) {
162186return 0;
163187}
164188此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。