Repository navigation
Conversation
- OAuth flow 按 realm 分域:intl=z.ai(data.zai 会话凭证需 z/login 换业务 token)、 cn=bigmodel.cn(data.bigmodel 即业务 token,免二次换取);init provider 随区域 - Account 增加 realm 字段并随导出/导入持久化;bigmodel 通道 JWT 凭证自动归位 zai/cn - 回退 API Key 业务域随区域(cn → open.bigmodel.cn),Plan 通道两端点同域不分 - 后台新增/授权登录支持区域选择;前端账号池展示区域与国内版授权引导 - Mock 上游支持 oauth_poll_realm 场景;新增 realm 单测与 cn 全流程集成测试
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
为账号池引入**双区域(realm)**支持:
intl(国际版 z.ai)与cn(国内版 bigmodel.cn),对齐官方客户端 3.14.x 实证行为(codeapi providers/zcode/realms.py)。动机
此前 bigmodel 通道只能手动粘贴 API Key,无法走 OAuth 免密登录;且国内版 OAuth 轮询返回的业务 token 结构与国际版不同(
data.bigmodel.access_token本身即业务 token,免二次换取),统一按 intl 流程处理会在z/login换取环节失败。改动要点
app/oauth.py):initprovider参数、业务 token 块名(intl=data.zai/ cn=data.bigmodel)、兑换链业务域(intl=api.z.ai/ cn=bigmodel.cn)均随 realm 走;cn 区域免z/login二次换取app/models.py):新增realm字段并随导入/导出持久化;区域缺省自动归区(bigmodel→cn,其余→intl);bigmodel 通道误贴 JWT 自动归位zai/cnapp/agent.py):cn 账号的回退 API Key 走open.bigmodel.cn;Plan 通道(messages/billing/claim)两端点同域,不分测试
tests/unit/test_models_realm.py(归区/持久化)、tests/integration/test_oauth_login.pycn 区域全流程用例(Mock 上游扩展oauth_poll_realm场景)pytest通过(341 例);ruff check app tests、mypy app/constants.py干净(与 CI 一致)