Skip to content

feat: support per-account proxy settings#30

Open
zerogzy wants to merge 9 commits into
zqbxdev:devfrom
zerogzy:feat/account-proxy-imports
Open

feat: support per-account proxy settings#30
zerogzy wants to merge 9 commits into
zqbxdev:devfrom
zerogzy:feat/account-proxy-imports

Conversation

@zerogzy

@zerogzy zerogzy commented Jun 12, 2026

Copy link
Copy Markdown

概述

本 PR 新增账号级代理配置能力。账号未设置代理时继续使用全局代理;账号设置代理后,上游请求会优先使用该账号自己的代理。

主要改动

  • 新增账号级 proxy 字段,并在账号归一化和保存时保留该字段。
  • 全局代理逻辑增加账号级代理优先级:账号代理优先,全局代理兜底。
  • ChatGPT、Grok、Gemini 的上游 Web 会话创建时传入账号信息,从而使用账号级代理。
  • 账号管理弹窗新增“账号代理”输入框。
  • 支持脱敏账号通过 account_id / row_id 修改账号代理;脱敏账号修改状态仍保持原有限制。
  • GPT、Grok、Gemini 的导入流程新增“账号代理”输入框。
  • Gemini / Grok 导入校验允许携带代理元数据,同时保留原有凭据格式限制。

行为说明

  • 账号 proxy 为空时:继续使用系统全局代理。
  • 账号 proxy 非空时:该账号请求优先使用账号代理。
  • 脱敏账号允许只修改代理;如果尝试修改状态,仍会提示需要重新导入或通过后端管理接口处理。
  • Gemini 导入仍只接受 __Secure-1PSID + __Secure-1PSIDTS 双字段。
  • Grok 导入仍只接受裸 SSO 或 sso=<值>,不会放宽到完整 Cookie Header。

验证

已执行以下检查:

python3 -m py_compile api/accounts.py services/account_service.py services/proxy_service.py services/network/client.py services/openai_backend_api.py services/providers/grok/client.py services/providers/gemini/client.py services/providers/gemini/accounts.py
npm ci
npm run build

@github-actions

Copy link
Copy Markdown

AI PR Review Refused

This PR targets main, but AI PR Review only runs for PRs targeting dev.
main is the stable release branch, and direct PRs to main are not accepted.
Please change the PR base branch to dev, then run AI PR Review again.

@zerogzy zerogzy changed the base branch from main to dev June 12, 2026 18:11
@github-actions

Copy link
Copy Markdown

AI PR Review Failed

The AI PR review could not be completed, so no review state was submitted.

Reason: OpenAI API returned HTTP 503.

1 similar comment
@github-actions

Copy link
Copy Markdown

AI PR Review Failed

The AI PR review could not be completed, so no review state was submitted.

Reason: OpenAI API returned HTTP 503.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants