From a2b2ad6f9da3bd212b44609637b4942e03154a9f Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Sun, 14 Apr 2024 18:45:48 +0100 Subject: [PATCH] fully use aiohttp session --- src/cogs/ollama.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cogs/ollama.py b/src/cogs/ollama.py index 482881f..beed4c7 100644 --- a/src/cogs/ollama.py +++ b/src/cogs/ollama.py @@ -102,7 +102,7 @@ class OllamaDownloadHandler: self.status = line["status"] async def __aiter__(self): - async with httpx.AsyncClient(base_url=self.base_url) as client: + async with aiohttp.ClientSession(base_url=self.base_url) as client: async with client.post("/api/pull", json={"name": self.model, "stream": True}, timeout=None) as response: response.raise_for_status() async for line in ollama_stream(response.content): @@ -164,7 +164,7 @@ class OllamaChatHandler: self._abort.set() async def __aiter__(self): - async with httpx.AsyncClient(base_url=self.base_url) as client: + async with aiohttp.ClientSession(base_url=self.base_url) as client: async with client.post( "/api/chat", json={