From 7f82d055fcb1994a534026abc42e723debb07bda Mon Sep 17 00:00:00 2001 From: wd041216-bit Date: Wed, 18 Mar 2026 20:35:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(ollama-stream):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=90=8D=E9=94=99=E8=AF=AF=E5=92=8CNode.js?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=85=BC=E5=AE=B9=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agents/ollama-stream.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/agents/ollama-stream.ts b/src/agents/ollama-stream.ts index 4049e610d30..dc816928a0b 100644 --- a/src/agents/ollama-stream.ts +++ b/src/agents/ollama-stream.ts @@ -565,7 +565,7 @@ export async function* parseNdjsonStream( // Reset buffer if we're done if (done && accumulatedBuffer.trim()) { try { - yield parseJsonPreservingUnsafeIntegers(accumBuffer.trim()) as OllamaChatResponse; + yield parseJsonPreservingUnsafeIntegers(accumulatedBuffer.trim()) as OllamaChatResponse; } catch { log.warn(`Skipping malformed trailing data: ${accumulatedBuffer.trim().slice(0, 120)}`); } @@ -749,17 +749,6 @@ export function createOllamaStreamFn( for await (const chunk of parseNdjsonStream(reader, config.bufferSize)) { const currentTime = Date.now(); - // Check connection health periodically - if (currentTime - lastConnectionCheck > connectionCheckInterval) { - if (!navigator.onLine) { - connectionHealthy = false; - log.warn("[manusilized] Connection lost, attempting to recover..."); - } else { - connectionHealthy = true; - } - lastConnectionCheck = currentTime; - } - // Throttle streaming to reduce UI updates if (currentTime - lastStreamTime < config.throttleDelay) { continue;