Repository navigation
fix(ORS-#842):车型问答主循环三修复——绕开单轮分支/选项截前3/已作答不注入过期约束 - #243
Open
usagiiiiiiii wants to merge 3 commits into
Open
usagiiiiiiii wants to merge 3 commits into
usagiiiiiiii wants to merge 3 commits into
Conversation
车辆选项引导规则只注入主循环 prompt(_vehicle_mode_block),出选项的唯一出口 也只挂在主循环(JSON 顶层 vehicle_choices → _validate_vehicle_choices → _finalize_diagnosis → result.vehicle_choices → 前端气泡)。而诊断意图默认落 单轮分支——纯文本流式,既没有那条规则也没有能携带选项的字段,模型只能把分叉树 整张表摊平在正文里(实锤:卸货/放货异常 A~G 全表直出,前端零气泡)。 按 _has_draft / _pending_proj_ask 同款守卫把车型会话挡回主循环: - 诊断分支(含 nokb 短路)与诊断工具循环分支 - 闲聊分支与意图兜底分支(短回复常被判成闲聊,落进去会丢 last_choices 承接规则) nokb 轮沿用省检索纪律不等检索(plan-execute 开时仍执行规划工具)。 另给 _validate_vehicle_choices 的整批丢弃加日志:选项被丢用户只看到一句没按钮的 空问题,事后翻日志是唯一线索。
原实现是整体丢弃制:条数超 3(分叉树节点最多 7 个分支)或有重复项就整批丢掉, result 里没有 vehicle_choices。而车辆块明令"不要在正文里罗列选项或编号", 所以正文里也没有清单——用户只看到一句没按钮的空问题,比原来的"一大坨"更难用。 丢弃是零可选,截断只是少分支(还有输入框「其他」兜底),两者代价不对等。 改为:清洗(丢非字符串/空串/超 30 字/重复)→ 不足 2 条才整批丢弃 → 超 3 条 截前 3。下限保留是机械判断(一条选项不成题)。配套改 prompt 为"分支多于 3 个 时只给常见程度最高的 3 个,并按该顺序排列"——截断取的是模型排过序的前 3, 否则等于随便取 3 个。截断/丢弃都打日志,可观测 prompt 遵从率。
last_choices 由上一轮写入,本轮构建 prompt 时它还在,但用户可能已经点选作答。 旧文案无条件断言「用户尚未回答」并禁止重复给出选项——该前提一旦失效,这条指令 会连下一层的新分叉一起压住(点选后沿树下钻的方向被摊成正文段落)。 改为按本轮 query 是否命中选项原文分流:命中则注入「用户已选择『X』,按该方向 继续;若其下仍有明确互斥的分支需再确认,照常输出下一层选项」,未命中保持旧文案; 不传 query 时与旧行为完全一致。两个调用点(_session_state_block、 _build_diagnosis_prompt)透传 original_query。 注:实机对照未复现出「点选后不出下一层」——旧代码在该场景下也能出题,本改动是指令 与事实对齐,不是被证实的 bug 修复。已验证叶子节点不会被带出多余选项。
This branch has not been deployed
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.
内容
车型专属问答(ORS-939 定制模式)走查实锤的三处修复,从
fix-ors-939-vehicle-choices-main-loop拆出(cherry-pick,原分支含 dar 增量工作另提 PR):验证