From 9d6920a24b7406dc2d916d757842fcd0c84e0ef9 Mon Sep 17 00:00:00 2001 From: retoor Date: Wed, 23 Apr 2025 17:38:14 +0000 Subject: [PATCH] chore: add debug print statements and fix done-check logic in websocket forwarding --- server.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 8aa6e3f..aa69f5d 100644 --- a/server.py +++ b/server.py @@ -17,16 +17,22 @@ class OllamaServer: async def forward_to_http(self, request_id, message): if request_id not in self.queues: self.queues[request_id] = asyncio.Queue() + print(message) await self.queues[request_id].put(message) async def forward_to_websocket(self, request_id, message, path): self.queues[request_id] = asyncio.Queue() + print(path,request_id,message) await self.ws.send_json(dict(request_id=request_id, data=message, path=path)) while True: chunk = await self.queues[request_id].get() yield chunk - if chunk.get('done'): + + if not 'done' in chunk: + break + + if chunk['done']: break async def serve(self):