Skip to content

Commit 04dccfc

Browse files
authored
Merge pull request #39 from iidamie/dev
fix: 添加了浏览器指纹设置
2 parents 7516ae5 + 40e7b62 commit 04dccfc

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.github/workflows/docker-image-dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828

2929
- name: Git Configuration
3030
run: |
31-
git config --global user.name "iidamie"
32-
git config --global user.email "iidamie@users.noreply.github.com"
31+
git config --global user.name "${{ github.actor }}"
32+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
3333
3434
- name: Semantic Release
3535
id: semantic

app.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,13 @@ def login_deepseek_via_account(account):
146146
"os": "android",
147147
}
148148
try:
149-
resp = requests.post(DEEPSEEK_LOGIN_URL, headers=BASE_HEADERS, json=payload)
149+
resp = requests.post(DEEPSEEK_LOGIN_URL, headers=BASE_HEADERS, json=payload, impersonate="safari15_3")
150150
resp.raise_for_status()
151151
except Exception as e:
152152
logger.error(f"[login_deepseek_via_account] 登录请求异常: {e}")
153153
raise HTTPException(status_code=500, detail="Account login failed: 请求异常")
154154
try:
155+
logger.warning(f"[login_deepseek_via_account] {resp.text}")
155156
data = resp.json()
156157
except Exception as e:
157158
logger.error(f"[login_deepseek_via_account] JSON解析失败: {e}")
@@ -193,7 +194,7 @@ def choose_new_account():
193194
acc_id = get_account_identifier(acc)
194195
if acc_id:
195196
# 从队列中移除并返回
196-
# logger.info(f"[choose_new_account] 新选择账号: {acc_id}")
197+
logger.info(f"[choose_new_account] 新选择账号: {acc_id}")
197198
return account_queue.pop(i)
198199

199200
logger.warning("[choose_new_account] 没有可用的账号或所有账号都在使用中")
@@ -262,7 +263,7 @@ def call_completion_endpoint(payload, headers, max_attempts=3):
262263
while attempts < max_attempts:
263264
try:
264265
deepseek_resp = requests.post(
265-
DEEPSEEK_COMPLETION_URL, headers=headers, json=payload, stream=True
266+
DEEPSEEK_COMPLETION_URL, headers=headers, json=payload, stream=True, impersonate="safari15_3"
266267
)
267268
except Exception as e:
268269
logger.warning(f"[call_completion_endpoint] 请求异常: {e}")
@@ -290,14 +291,16 @@ def create_session(request: Request, max_attempts=3):
290291
headers = get_auth_headers(request)
291292
try:
292293
resp = requests.post(
293-
DEEPSEEK_CREATE_SESSION_URL, headers=headers, json={"agent": "chat"}
294+
DEEPSEEK_CREATE_SESSION_URL, headers=headers, json={"agent": "chat"}, impersonate="safari15_3"
294295
)
295296
except Exception as e:
296297
logger.error(f"[create_session] 请求异常: {e}")
297298
attempts += 1
298299
continue
299300
try:
301+
logger.warning(f"[create_session] {resp.text}")
300302
data = resp.json()
303+
301304
except Exception as e:
302305
logger.error(f"[create_session] JSON解析异常: {e}")
303306
data = {}
@@ -444,6 +447,7 @@ def get_pow_response(request: Request, max_attempts=3):
444447
headers=headers,
445448
json={"target_path": "/api/v0/chat/completion"},
446449
timeout=30,
450+
impersonate="safari15_3",
447451
)
448452
except Exception as e:
449453
logger.error(f"[get_pow_response] 请求异常: {e}")

0 commit comments

Comments
 (0)