Next test of timeout
This commit is contained in:
@@ -101,12 +101,17 @@ def parse_args():
|
|||||||
help="Embedding model name (default: bge-m3:latest)",
|
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(
|
parser.add_argument(
|
||||||
"--timeout",
|
"--timeout",
|
||||||
default=300,
|
default=None,
|
||||||
help="Timeout is seconds (useful when using slow AI)",
|
type=timeout_type,
|
||||||
|
help="Timeout in seconds (useful when using slow AI). Use None for infinite timeout",
|
||||||
)
|
)
|
||||||
|
|
||||||
# RAG configuration
|
# RAG configuration
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--max-async", type=int, default=4, help="Maximum async operations (default: 4)"
|
"--max-async", type=int, default=4, help="Maximum async operations (default: 4)"
|
||||||
|
@@ -407,11 +407,10 @@ async def lollms_model_if_cache(
|
|||||||
full_prompt += prompt
|
full_prompt += prompt
|
||||||
|
|
||||||
request_data["prompt"] = full_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:
|
async with aiohttp.ClientSession(timeout=timeout) as session:
|
||||||
if stream:
|
if stream:
|
||||||
|
|
||||||
async def inner():
|
async def inner():
|
||||||
async with session.post(
|
async with session.post(
|
||||||
f"{base_url}/lollms_generate", json=request_data
|
f"{base_url}/lollms_generate", json=request_data
|
||||||
|
Reference in New Issue
Block a user