Repository navigation
Conversation
The pool page rendered both supplier cards unconditionally, so a user who had never signed in to the international build still got a full international card on every visit: its endpoint, its model count at 0, and a four-step guide to installing an app they do not have. 绑定了哪个渠道,就显示什么渠道. `visibleRegionCards` answers which lanes to draw from the counts the card already holds, so the pool page and the login page never derive "is this lane bound" twice. Three states, because "no answer yet" is not "no accounts": - some lane bound -> exactly those lanes - all answered, empty -> both, because a fresh install has no other door in - still reading -> none, so a lane cannot flash in and collapse back out A filtered-out lane is still POLLED: a sign-in performed while the page is open has to make its lane appear without a reload. `REGION_CARD_ORDER` becomes the one list the poll loop, the render loop and the filter share. The account-usage picker moves with it. It was pinned to the domestic card alongside the automation switch, so an international-only user would have lost a control that still applies: the distribution is one setting for the ONE pool instance both gateways draw from. It now hangs off the first VISIBLE lane, which is `cn` for every domestic user, while automation stays CN-only because that gateway genuinely has no growth system. Verified: tsc (host) 0, tsc (client) 0, tsdown 0, vitest 1400 passed with the two D:-only windows-registry cases failing as documented.
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.
问题
账号池首页无条件渲染两张 region 卡(国内版 + 国际版)。没绑国际版账号的用户每次打开都要面对一整张国际版卡:端点、模型数 0、以及一整套「怎么装 WorkBuddy AI、怎么注册国际版号」的引导。用户要求:绑定了哪个渠道,就显示什么渠道。
改法
src/client/region-card.tsx新增visibleRegionCards(accountCounts),从卡片手里已有的状态文档判断该画哪几条 lane,不再单独推一遍「这条 lane 有没有绑」:ChannelPoolSection在「一条都没绑」时放弃过滤是同一条规则被过滤掉的 lane 仍然在轮询:在扫码登录页完成一次登录要能当场让对应的卡出现,不需要刷新。
REGION_CARD_ORDER成为轮询循环、渲染循环、过滤器共用的唯一一份 lane 列表 —— 两份手写 pair 就是「轮询了却从不渲染」的来源。连带修掉的一处
「账号使用方式」(distribution)选择器原本和 automation 开关一起钉在
region === 'cn'上。lane 一旦会被隐藏,只绑国际版的用户就没有任何卡片承载它 —— 而 distribution 是同一个 pool 实例的属性(一个 settings key、两个网关共用),不是国内版专属设置。现在它挂在第一条可见 lane 上(国内版可见时就是国内版,国内版用户看到的没有任何变化);automation 仍然只在 cn,因为国际版网关确实没有成长体系。验证
tsc -p tsconfig.json→ 0tsc -p tsconfig.client.json→ 0tsdown→ 0,lib/client.js已随源码一起提交vitest run→ 1400 passed / 2 failed,失败只有tests/windows-registry-encoding.test.ts两条硬编码写D:\_dsh_enc_probe的用例(本机 D: 是只读安装介质,CI 的windows-latest不受影响)新增/改写的断言:
visibleRegionCards五个状态各自一条用例(只绑国内 / 只绑国际 / 两条都绑 / 全空 / 尚未答完)REGION_CARDS = REGION_CARD_ORDER,且卡里不再出现第二份['cn', 'global']字面量host-compat.test.ts的「两条 lane 都渲染」改为「每条已绑定的 lane 都渲染」