Repository navigation
Conversation
… daily The channel could only ever log into workbuddy.ai — wbAccountFromToken refused any other issuer outright, so a codebuddy.cn account could not be added at all. The two publishments now ride a realm table: chat on copilot.tencent.com, the billing meter on www.codebuddy.cn (a different host, which is why the meter 404'd when asked on the chat one), each with its own Origin/X-Domain/UA family. The realm is the login the user opened, unless the token's issuer names one — a silent issuer must not silently downgrade a CN account to intl. CN also earns its daily differently. intl claims it with a tiny conversation; CN has a real endpoint for it, /v2/billing/meter/ daily-checkin, which answers HTTP 400 with code 10001 once the day is claimed — so the day closes on that code too, instead of retrying hourly against a wall. The hourly tick runs whichever daily the account's realm has; the card grows a 版本 picker and a 签到 button for CN. The static free-model catalog is untouched: hy4-preview-f, hy3 and deepseek-v4.1-flash exist on both publishments. go vet ./... and go test ./... are green.
Owner
|
@ghshhf CN realm 支持的设计读过了——多域名拆分(聊天 host 与 manager host 分离、realm 配置对象取代硬编码常量)是对的,CI 三平台也绿。但目前 mergeable=false:它落后 master 4 个提交,#90/#88/#86 刚改过 |
Owner
|
已通过 rebase 版 #93 合并(原分支落后 master 4 个提交、与 #90/#88/#86 重叠所以 mergeable=false)。设计完全按你的来——两个 publishment 域名拆分(chat 走 copilot.tencent.com、meter 走 www.codebuddy.cn)、realm 配置对象取代硬编码、CN 走真实签到端点而非 intl 的活动对话,都很到位。我只做了 rebase + 冲突解决(client.go 插 wbLoginRealm 字段、workbuddy_test.go 两侧测试都保留)。作者署名保留在你名下。感谢这份贡献。 |
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.
The WorkBuddy channel could only ever log into the international publishment.
wbAccountFromTokenrefused any issuer that did not containworkbuddy.ai, so a codebuddy.cn account was rejected at the door with 令牌不属于国际版(workbuddy.ai),本渠道暂只支持国际版 — there was no way to add one.This PR teaches the lane both publishments, and gives the CN one its real daily-earn endpoint.
The two publishments are not one host
That is the part worth knowing before reading the diff. CN splits across domains:
copilot.tencent.com+/v2/chat/completionswww.workbuddy.ai+/v2/chat/completionswww.codebuddy.cnwww.workbuddy.aiAsking the meter on the chat host is why the CN credit read 404'd. The realm now carries the whole family — base, billing base, Origin, X-Domain, user-agent — through a table, so login, refresh, chat and the credit read each land on the right host.
The realm is the publishment the user picked when opening the login, unless the token's own issuer names one: a silent issuer must not silently downgrade a CN account to intl.
CN earns its daily through an endpoint, not a conversation
intl claims the daily with a one-token conversation (the shape fixed in #85). CN has a real one:
POST /v2/billing/meter/daily-checkin.It answers HTTP 400 with
code: 10001今天已签到 once the day is claimed. Judging by status alone would log a failure and retry hourly against a wall all day, so 10001 is treated as idempotent success and closes the local day. The hourly tick runs whichever daily the account's realm has.What deliberately did not change
hy4-preview-f,hy3anddeepseek-v4.1-flashexist on both publishments; inventing CN-only model ids would have been guessing.realmandlastCheckinDate, but it is still one account. A pool is a different change and a different risk profile.On the endpoints
The domain split and the checkin path are taken from
ardeyouxipianyi/workbuddy2api-hub(MIT), which already drives both publishments. They are consistent with the CN client's own traffic, but I could not verify them end to end: finishing a CN login needs a codebuddy.cn account to scan the QR, which I do not have. The chat path, the meter host and the checkin code handling are covered by tests against a local server; the live CN handshake is not. If a CN account is available, the 版本 picker on the card now offers 国内版 and the 签到 button exercises the whole path.Tests
Five added, on
internal/lane:10001answer closes the day instead of retryingcopilot.tencent.comfor chatgo vet ./...andgo test ./...are green (17 packages).