fully use aiohttp session
This commit is contained in:
parent
3a3804fc18
commit
a2b2ad6f9d
1 changed files with 2 additions and 2 deletions
|
@ -102,7 +102,7 @@ class OllamaDownloadHandler:
|
||||||
self.status = line["status"]
|
self.status = line["status"]
|
||||||
|
|
||||||
async def __aiter__(self):
|
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:
|
async with client.post("/api/pull", json={"name": self.model, "stream": True}, timeout=None) as response:
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
async for line in ollama_stream(response.content):
|
async for line in ollama_stream(response.content):
|
||||||
|
@ -164,7 +164,7 @@ class OllamaChatHandler:
|
||||||
self._abort.set()
|
self._abort.set()
|
||||||
|
|
||||||
async def __aiter__(self):
|
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(
|
async with client.post(
|
||||||
"/api/chat",
|
"/api/chat",
|
||||||
json={
|
json={
|
||||||
|
|
Loading…
Reference in a new issue