Update.
This commit is contained in:
parent
22d646e8ae
commit
91d22f25fe
@ -51,11 +51,10 @@ async def websocket_client(url: str, ollama_url: str) -> None:
|
||||
async def main(concurrency: int, ollama_url: str) -> None:
|
||||
url = 'https://ollama.molodetz.nl'
|
||||
|
||||
tasks = []
|
||||
for _ in range(concurrency):
|
||||
tasks.append(websocket_client(url, ollama_url))
|
||||
|
||||
while True:
|
||||
tasks = []
|
||||
for _ in range(concurrency):
|
||||
tasks.append(websocket_client(url, ollama_url))
|
||||
try:
|
||||
await asyncio.gather(*tasks)
|
||||
except Exception as e:
|
||||
|
@ -113,7 +113,7 @@ async def http_handler(request):
|
||||
import json
|
||||
try:
|
||||
async for result in server_manager.forward_to_websocket(request_id, data, path=request.path):
|
||||
await resp.write(json.dumps(result).encode() + b'\n')
|
||||
await resp.write(json.dumps(result).encode())
|
||||
except NoServerFoundException:
|
||||
await resp.write(json.dumps(dict(error="No server with that model found.",available=server_manager.get_models())).encode() + b'\n')
|
||||
await resp.write_eof()
|
||||
|
Loading…
Reference in New Issue
Block a user