Repository navigation
fix: 提示词增强自动通道跟随当前选型,设置页不再截断文案 - #9
Merged
Merged
Conversation
自动通道原先取 Selection View 的 preferredSelection,那是 Registry 的初始推荐:配置里 没有可用默认模型时会回落到第一个可见 provider 的第一个模型,用户改选模型后它并不跟着 变,于是增强会跑去用一个用户没选的模型。改为由 composer 注入当前草稿的生效选型 (draftConfig.modelSelection,与工具栏展示、提交门禁同源),模型与推理档位都随之跟随。 设置页「当前生效通道」在自动模式下改为「跟随选择的模型和推理强度」(全局设置页给不出 唯一模型,只说明它跟随什么),并去掉该行的 truncate:字号放大后「推理强度」会被截断吃掉, `--ui-font-size` 可调而列宽是固定 px,因此改用 wide 布局 + 换行。
Owner
|
已核对:自动通道改为跟随 composer 当前草稿选型( |
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.
问题
提示词增强的「自动」通道用的是提供商的第一个模型,而不是用户当前选择的模型和推理强度。
根因
usePromptEnhance.ts把modelSelectionView.preferredSelection当作自动通道的基准选型,而它是 Registry 的初始推荐(resolveInitialModelSelection):只有配置里的默认模型仍然合法时才用默认模型,否则回落到 registry 里第一个可见 provider 的第一个模型(registry-fallback)。用户之后在输入框旁改选模型,这个值并不会跟着变。用户当前真正的选型在别处:
draftConfig.modelSelection(=resolveComposerModelSelection(draft.modelSelection, view),含账号套餐重映射),也就是工具栏展示与提交门禁共用的那一个。改动
行为
currentModelSelection),模型与推理档位都随之跟随;切模型 / 切档位即刻生效,无需重新配置。resolvePromptEnhanceTarget的入参preferredSelection改名currentSelection,模块头注释写明为何刻意不读preferredSelection。!target分支,并在日志里区分三种构造不出请求的原因(草稿无选型 / 模型已不在已发布列表 / 独立通道未配),仍提示「没有可用的增强模型」。文案与布局
truncate:--ui-font-size由外观设置控制、可以调大,而SettingsRow的列宽是固定 px 不跟着放大,放大字号后「推理强度」会被直接截断吃掉。改用controlLayout="wide"(192px → 280px)+break-words,放不下时换行。影响与边界
preferredSelection兜底,改动后按既有口径提示「没有可用的增强模型」——这与输入框此时本身也发不出消息是一致的。preferredSelection的链路不在本次范围,如需一并改可另开。验证
pnpm exec tsx --test packages/ui/test/promptEnhance.test.ts→ 23/23 通过;含新增对照断言:换一个currentSelection,模型、预算与档位都跟着换,锁住「不再从 Selection View 的初始推荐里补一个模型」pnpm typecheck→ 通过pnpm lint→ 0 error / 63 warning(与改动前基线一致)pnpm architecture:check --changed→ 0 违规