Fix health check fake request state binding
Browse files- app/account.py +8 -6
app/account.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import logging
|
| 2 |
import random
|
|
|
|
| 3 |
|
| 4 |
from curl_cffi import requests
|
| 5 |
from fastapi import HTTPException, Request
|
|
@@ -254,12 +255,13 @@ def account_health_check(account, timeout=30):
|
|
| 254 |
ensure_hif_tokens(account)
|
| 255 |
|
| 256 |
# 2. 创建会话 —— 需要伪造一个 request 对象
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
deepseek_token
|
| 260 |
-
account
|
| 261 |
-
use_config_token
|
| 262 |
-
|
|
|
|
| 263 |
|
| 264 |
session_id = create_session(fake_req)
|
| 265 |
if not session_id:
|
|
|
|
| 1 |
import logging
|
| 2 |
import random
|
| 3 |
+
from types import SimpleNamespace
|
| 4 |
|
| 5 |
from curl_cffi import requests
|
| 6 |
from fastapi import HTTPException, Request
|
|
|
|
| 255 |
ensure_hif_tokens(account)
|
| 256 |
|
| 257 |
# 2. 创建会话 —— 需要伪造一个 request 对象
|
| 258 |
+
fake_req = SimpleNamespace(
|
| 259 |
+
state=SimpleNamespace(
|
| 260 |
+
deepseek_token=account.get("token"),
|
| 261 |
+
account=account,
|
| 262 |
+
use_config_token=True,
|
| 263 |
+
)
|
| 264 |
+
)
|
| 265 |
|
| 266 |
session_id = create_session(fake_req)
|
| 267 |
if not session_id:
|