Next test of timeout

This commit is contained in:
Saifeddine ALOUI
2025-01-10 22:17:13 +01:00
parent ab3cc3f0f4
commit a619b01064
2 changed files with 9 additions and 5 deletions

View File

@@ -101,12 +101,17 @@ def parse_args():
help="Embedding model name (default: bge-m3:latest)",
)
def timeout_type(value):
if value is None or value == "None":
return None
return int(value)
parser.add_argument(
"--timeout",
default=300,
help="Timeout is seconds (useful when using slow AI)",
default=None,
type=timeout_type,
help="Timeout in seconds (useful when using slow AI). Use None for infinite timeout",
)
# RAG configuration
parser.add_argument(
"--max-async", type=int, default=4, help="Maximum async operations (default: 4)"

View File

@@ -407,11 +407,10 @@ async def lollms_model_if_cache(
full_prompt += prompt
request_data["prompt"] = full_prompt
timeout = aiohttp.ClientTimeout(total=kwargs.get("timeout", 300)) # 300 seconds = 5 minutes
timeout = aiohttp.ClientTimeout(total=kwargs.get("timeout", None))
async with aiohttp.ClientSession(timeout=timeout) as session:
if stream:
async def inner():
async with session.post(
f"{base_url}/lollms_generate", json=request_data