From 9784b65b1c717193d5787d7b6897d9ab58c46b69 Mon Sep 17 00:00:00 2001 From: nex Date: Fri, 10 Nov 2023 23:43:32 +0000 Subject: [PATCH] Debug ollama more! --- cogs/other.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cogs/other.py b/cogs/other.py index 34fedd7..9080b0c 100644 --- a/cogs/other.py +++ b/cogs/other.py @@ -93,7 +93,9 @@ async def ollama_stream_reader(response: httpx.Response) -> typing.AsyncGenerato async for chunk in response.aiter_bytes(8192): # Each chunk is a JSON string try: - yield json.loads(chunk.strip().decode("utf-8", "replace")) + loaded = json.loads(chunk.strip().decode("utf-8", "replace")) + print("Loaded chunk: %r", loaded) + yield loaded except json.JSONDecodeError as e: print("Failed to decode chunk %r: %r" % (chunk, e), file=sys.stderr) pass