Repository navigation
对齐系统提示词与代码:来源标签、能力行与选区去重 - #503
Merged
Merged
Conversation
- 来源表达改为原样使用工具返回的 [材料:r2.3] 轮次序号标签,删除标题式示例 - 引文解析器补「问答」kind,孤儿问答引用渲染为问答胶囊而非残留原文 - 删除代码中不存在的 readableSourceLabels 规则,全量核对反引号标识符均有定义 - turnContext 有选区来源时不再重复注入 selection 原文 - webiSystemPrompt 按服务商注入静态原生网页搜索能力行,nil 不输出 - 课程知识档案点名 weibei_course_profile_update 并写清与学习记忆分工 - 删除与 system.md 重复的 retrievalStrategy 段
复审发现:Store 侧选区摘录截到 400 字(WorkspaceStore agentSelectionSources), 去重后模型只能看到截断片段。改为: - turnContext 恢复只要 selectionText 非空即写完整原文 - 选区来源投影剥掉 excerpt,仅留标签定位,模型仍按 [选区:rN.M] 引用 - 测试改为 1000+ 字选文/400 字摘录,断言完整选文进入且仅出现一次 - 网页搜索第 2 条补"未标明时按不提供处理",覆盖能力行为 nil 的情况
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.
解决什么
系统提示词多处描述与代码实际行为不一致,模型被迫在冲突指令间自选(来源标签格式两套说法)、引用不存在的字段、无从判断本服务是否有原生网页搜索。按计划文档逐项对齐(六项,不改人设语气、不改工具 schema 与后端):
label/source.label([材料:r2.3]轮次序号格式),删除标题式示例;AgentCitationParser补「问答」kind(含流式截断前缀),孤儿问答引用渲染为问答胶囊而非残留原文。readableSourceLabels:代码中不存在;第 7 条改为「参考数据和工具结果里都没有来源时」。system.md 全部反引号标识符已逐一 grep 核对有定义。agentSelectionSources的prefix(400),供 UI 与持久化,不改)。selection字段始终携带完整选文;sources投影里选区来源剥掉excerpt只留标签定位,模型仍按[选区:rN.M]引用,与选文「片段 N(来源:标题)」头按顺序对应。(首版曾改为"有 sources 即跳过 selection",复审发现导致长选区只剩 400 字摘录,已按复审结论修正。)webiSystemPrompt新增webSearchAvailable,按服务商路由注入一行静态「本/不提供原生网页搜索」说明(order 16,缓存前缀不受影响);子智能体经同一装配入口自动继承;system.md 第 2、5 条改为引用该行,并补「未标明时按不提供处理」。weibei_course_profile_update,写清「自述掌握程度→档案;目标/困惑/偏好/进度/作答→记忆;同一件事只写一处」。retrievalStrategy:三行完全复述 system.md,删除后由缓存前缀测试守护。计划文档(含复审结论与执行记录):
~/projects/魏碑/Docs/plans/2026-09-17-系统提示词与代码对齐修复.md。怎么验证
swift test --jobs 4 --filter 'NativeAgentRuntimeTests|NativeModelUsageTests|WorkspaceSearchSafetyTests'→ 58/58 通过(合并 origin/main 让对话连续呈现:问题上移、新文字淡入与工具活动折叠 #498 后实跑,含其新增 4 个测试)。含testTurnContextSendsFullSelectionOnceWithoutTrimmedExcerpts:1000+ 字选文/400 字摘录,断言完整选文进入且仅出现一次;两个缓存前缀测试;testLoopSendsFullSelectionAndQuestionToModel。计划原文的\|过滤写法在 SwiftPM 下静默匹配 0 测试,已用普通|。swift run WeiBeiSelfCheck --native-agent→ 通过(含 genui / genui-advanced 技能目录断言)。81aed800)无冲突,合并提交1c59cd67,合并后上述回归重跑全绿。还有什么风险
verify_app_launch.sh非 CI 拒绝自动开 App;当时机器有并行会话),三轮四栏清单见计划文档,用户决定跳过真机抽查后合并。代码层等价验证由单元测试覆盖(选区完整性与唯一性、能力行三种输出、缓存前缀稳定)。测试包在worktrees/agent-prompt-alignment/dist/魏碑.app(WeiBeiGitCommit=d3df5aad,不含后续合并提交)。[问答:…]引用胶囊点击暂无动作(同会话胶囊);接openAgentCitation(kind: "discussion")超出本次范围,已记「待议」。