Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ model = os.getenv("MODEL_NAME")
|
|
17 |
# 代理服务器配置
|
18 |
PROXY_BASE_URL = os.getenv("PROXY_API_BASE", "http://localhost:8000")
|
19 |
PROXY_TIMEOUT = int(os.getenv("PROXY_TIMEOUT", 30))
|
20 |
-
MAX_RETRIES = int(os.getenv("MAX_RETRIES",
|
21 |
# 保存历史
|
22 |
save_history = True
|
23 |
|
@@ -165,7 +165,7 @@ def chat_with_retry(history_messages, max_retries=MAX_RETRIES):
|
|
165 |
|
166 |
if attempt < max_retries - 1:
|
167 |
# 指数退避
|
168 |
-
wait_time = 2 ** attempt
|
169 |
logger.info(f"Retrying in {wait_time} seconds...")
|
170 |
time.sleep(wait_time)
|
171 |
else:
|
|
|
17 |
# 代理服务器配置
|
18 |
PROXY_BASE_URL = os.getenv("PROXY_API_BASE", "http://localhost:8000")
|
19 |
PROXY_TIMEOUT = int(os.getenv("PROXY_TIMEOUT", 30))
|
20 |
+
MAX_RETRIES = int(os.getenv("MAX_RETRIES", 5))
|
21 |
# 保存历史
|
22 |
save_history = True
|
23 |
|
|
|
165 |
|
166 |
if attempt < max_retries - 1:
|
167 |
# 指数退避
|
168 |
+
wait_time = min(2 ** attempt, 4)
|
169 |
logger.info(f"Retrying in {wait_time} seconds...")
|
170 |
time.sleep(wait_time)
|
171 |
else:
|