Uh oh!
There was an error while loading. Please reload this page.
fix(settings): let the models page set the default connection - #2421
Merged
Conversation
Closes#158. Changing the default connection was possible only from the command palette. The models page displayed a 默认 Badge on whichever connection held it and offered no way to change it — so a user who went looking where the answer is shown found a read-only label. One of them said so: "这默认模型连接改不了吗, 在模型里找半天." They were looking in exactly the right place. The badge slot in the connection detail header now carries both halves of the same fact: the default connection shows the Badge, and any other connection shows a 设为默认 button in its place. Whichever a connection is, that slot tells you — and is how you change it. `clickAction` rather than onClick: this opens no confirmation, so there is no state-driven UI to await inside the transition, and the pending affordance comes with it. On failure the toast reports and the state does not move, which leaves the button where it was to retry. The command palette entry stays. It was never wrong, only invisible.
Review caught that ghost was the wrong variant here. A ghost button alone beside a title is bare text, which reads as a subtitle rather than something pressable — recreating the exact problem this change exists to solve, on the one surface where a user has already demonstrated that not-obvious means not-found. secondary sm matches 测试连接 directly below it, which is this page's dialect for a quiet but unmistakable control.
jackwener
commented
Aug 7, 2026
MemberAuthor
Review by maka-审美专家 — 通过:「设为默认」控件落地在状态显示的同一槽位(控件贴对象法则),secondary sm 与同页 测试连接 同方言(首版 ghost 读作文字标签的问题经截图证实后改判,变体取舍理由留注释防回改);交互闭环以计数断言实证(按钮 1→0、Badge 0→1);护栏不加的裁定成立——禁用态自述规矩管已存在的禁用态,不发明禁用条件;命令面板入口保留。CI 绿。合入。 |
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Closes#158。
问题
换默认连接只能从命令面板(⌘K)。模型页在默认连接上挂着「默认」Badge——状态看得见,控件不存在。用户反馈原话:「这默认模型连接改不了吗,在模型里找半天」——他找的地方是对的,是界面把路堵死了。
改法
连接详情头部那个槽位现在同时承担一件事的两面:
状态在哪显示,控件就在哪。
用
clickAction:不弹确认,所以事务里没有 state 驱动的 UI 要等(无死锁风险),pending 态自带。失败时 toast 报错、状态不动,按钮留在原地可重试。命令面板入口保留——它从来没错,只是看不见。
验证
真机 e2e 跑通两态并确认交互闭环:
截图两张(按钮态 / Badge 态)已发任务线程。typecheck(我的文件)/ lint / format 全绿;
ProvidersPanel相关 e2e 断言扫过,只有「默认模型」那组,和本改动的「默认连接」是两个概念,无碰撞。一处留给设计裁定
spec 第 3 条要求"不可设默认时按钮禁用且说明原因"——我查了后端,
connections:setDefault只在连接不存在时报错,没有任何可用性/凭据门槛,任何存在的连接都能设默认。所以没有可禁用的条件,我没有发明一个。要不要给"连接不可用时设默认"加护栏,是产品判断。