From d2623d8a21c76f524ee979a8b1575b7c8c6ddfd5 Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Tue, 20 Aug 2024 10:32:54 -0700 Subject: [PATCH] Fix decoder issue in streaming response --- ask-llm.js | 2 +- ask-llm.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ask-llm.js b/ask-llm.js index 8a4fa58..120eb53 100755 --- a/ask-llm.js +++ b/ask-llm.js @@ -100,7 +100,7 @@ const chat = async (messages, handler) => { break; } if (line.length > 0) { - const partial = parse(line); + const partial = parse(line.trim()); if (partial === null) { buffer = line; } else if (partial && partial.length > 0) { diff --git a/ask-llm.py b/ask-llm.py index c5a17b9..c63c6d5 100755 --- a/ask-llm.py +++ b/ask-llm.py @@ -90,7 +90,7 @@ def parse(line): finished = True break elif line: - partial = parse(line) + partial = parse(line.strip()) if partial is not None: if len(full_answer) == 0: full_answer = partial.strip()