Debug lines and more logic sequence of code.
This commit is contained in:
parent
5cfc2218fd
commit
5e8f1a10e5
@ -17,16 +17,22 @@ class OllamaServer:
|
|||||||
async def forward_to_http(self, request_id, message):
|
async def forward_to_http(self, request_id, message):
|
||||||
if request_id not in self.queues:
|
if request_id not in self.queues:
|
||||||
self.queues[request_id] = asyncio.Queue()
|
self.queues[request_id] = asyncio.Queue()
|
||||||
|
print(message)
|
||||||
await self.queues[request_id].put(message)
|
await self.queues[request_id].put(message)
|
||||||
|
|
||||||
async def forward_to_websocket(self, request_id, message, path):
|
async def forward_to_websocket(self, request_id, message, path):
|
||||||
self.queues[request_id] = asyncio.Queue()
|
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))
|
await self.ws.send_json(dict(request_id=request_id, data=message, path=path))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
chunk = await self.queues[request_id].get()
|
chunk = await self.queues[request_id].get()
|
||||||
yield chunk
|
yield chunk
|
||||||
if chunk.get('done'):
|
|
||||||
|
if not 'done' in chunk:
|
||||||
|
break
|
||||||
|
|
||||||
|
if chunk['done']:
|
||||||
break
|
break
|
||||||
|
|
||||||
async def serve(self):
|
async def serve(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user