Adjust ollama timeouts
This commit is contained in:
parent
6fb9bb839b
commit
19bd4030d0
1 changed files with 9 additions and 4 deletions
|
@ -487,7 +487,9 @@ class Ollama(commands.Cog):
|
|||
"""Checks that a server is online and responding."""
|
||||
if url in SERVER_KEYS:
|
||||
url = CONFIG["ollama"][url]["base_url"]
|
||||
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(10)) as session:
|
||||
async with aiohttp.ClientSession(
|
||||
timeout=aiohttp.ClientTimeout(connect=3, sock_connect=3, sock_read=10, total=3)
|
||||
) as session:
|
||||
self.log.info("Checking if %r is online.", url)
|
||||
try:
|
||||
async with session.get(url + "/api/tags") as resp:
|
||||
|
@ -550,7 +552,11 @@ class Ollama(commands.Cog):
|
|||
|
||||
if query == "$":
|
||||
v = PromptSelector(ctx)
|
||||
await ctx.respond("Select edit your prompts, as desired. Click done when you want to continue.", view=v)
|
||||
await ctx.respond(
|
||||
"Select edit your prompts, as desired. Click done when you want to continue.",
|
||||
view=v,
|
||||
ephemeral=True
|
||||
)
|
||||
await v.wait()
|
||||
query = v.user_prompt or query
|
||||
system_query = v.system_prompt
|
||||
|
@ -606,7 +612,7 @@ class Ollama(commands.Cog):
|
|||
|
||||
async with aiohttp.ClientSession(
|
||||
base_url=server_config["base_url"],
|
||||
timeout=aiohttp.ClientTimeout(connect=30, sock_read=10800, sock_connect=30, total=10830),
|
||||
timeout=aiohttp.ClientTimeout(connect=5, sock_read=10800, sock_connect=5, total=10830),
|
||||
) as session:
|
||||
embed = discord.Embed(
|
||||
title="Checking server...",
|
||||
|
@ -992,7 +998,6 @@ class Ollama(commands.Cog):
|
|||
)
|
||||
|
||||
msg = await ctx.reply(embed=embed)
|
||||
last_edit = time.time()
|
||||
|
||||
tasks = {}
|
||||
for server in self.servers.keys():
|
||||
|
|
Loading…
Reference in a new issue