Debug ollama

This commit is contained in:
Nexus 2023-11-10 23:40:27 +00:00
parent 13322ad134
commit 0848cdcc0b
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -94,7 +94,8 @@ async def ollama_stream_reader(response: httpx.Response) -> typing.AsyncGenerato
# Each chunk is a JSON string
try:
yield json.loads(chunk.strip().decode("utf-8", "replace"))
except json.JSONDecodeError:
except json.JSONDecodeError as e:
print("Failed to decode chunk %r: %r" % (chunk, e), file=sys.stderr)
pass