Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -258,7 +258,8 @@ def generate_reply(
|
|
| 258 |
for i, url in enumerate(api_urls):
|
| 259 |
try:
|
| 260 |
label = "Primary" if i == 0 else "Fallback(H100)"
|
| 261 |
-
|
|
|
|
| 262 |
|
| 263 |
resp = requests.post(url, json=request_body,
|
| 264 |
stream=True, timeout=15, verify=False)
|
|
@@ -300,12 +301,12 @@ def generate_reply(
|
|
| 300 |
except (requests.exceptions.ConnectionError,
|
| 301 |
requests.exceptions.Timeout,
|
| 302 |
requests.exceptions.ReadTimeout) as e:
|
| 303 |
-
print(f"[API] {label} failed:
|
| 304 |
if i < len(api_urls) - 1:
|
| 305 |
print(f"[API] Switching to fallback...", flush=True)
|
| 306 |
continue
|
| 307 |
else:
|
| 308 |
-
yield
|
| 309 |
except Exception as exc:
|
| 310 |
yield f"**Error:** `{exc}`"
|
| 311 |
return
|
|
|
|
| 258 |
for i, url in enumerate(api_urls):
|
| 259 |
try:
|
| 260 |
label = "Primary" if i == 0 else "Fallback(H100)"
|
| 261 |
+
masked = url.split("/v1")[0][:20] + "***"
|
| 262 |
+
print(f"[API] {label}: {masked}", flush=True)
|
| 263 |
|
| 264 |
resp = requests.post(url, json=request_body,
|
| 265 |
stream=True, timeout=15, verify=False)
|
|
|
|
| 301 |
except (requests.exceptions.ConnectionError,
|
| 302 |
requests.exceptions.Timeout,
|
| 303 |
requests.exceptions.ReadTimeout) as e:
|
| 304 |
+
print(f"[API] {label} failed: connection error", flush=True)
|
| 305 |
if i < len(api_urls) - 1:
|
| 306 |
print(f"[API] Switching to fallback...", flush=True)
|
| 307 |
continue
|
| 308 |
else:
|
| 309 |
+
yield "**❌ 모든 API 연결 실패.** 서버 상태를 확인하세요."
|
| 310 |
except Exception as exc:
|
| 311 |
yield f"**Error:** `{exc}`"
|
| 312 |
return
|