From ce5d664f828de8681ee7129dfec3c16cad667c46 Mon Sep 17 00:00:00 2001 From: TKSun <1037305420@qq.com> Date: Tue, 11 Mar 2025 21:05:26 +0800 Subject: [PATCH] fix: issue 3732 ollama version 0.3.12 responses first line as {"id":"x","done":false} without a response value which crashes execution. --- core/llm/llms/Ollama.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index 675fd8663..1a409c5f9 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -359,6 +359,7 @@ class Ollama extends BaseLLM implements ModelInstaller{ if ("error" in j) { throw new Error(j.error); } + j.response ??= '' yield j.response; } catch (e) { throw new Error(`Error parsing Ollama response: ${e} ${chunk}`);