docs(phase-06): diagnose UAT gaps and add gap closure plan

This commit is contained in:
肖应宇 2026-04-15 11:30:46 +08:00
parent 16cc99febb
commit ce731aff30
2 changed files with 132 additions and 9 deletions

View File

@ -0,0 +1,94 @@
---
phase: 06-
plan: 04
type: execute
wave: 4
depends_on:
- 06-01
- 06-02
- 06-03
gap_closure: true
files_modified:
- frontend/src/components/workspace/input-box.tsx
- frontend/src/components/ai-elements/prompt-input.tsx
- frontend/src/core/threads/submit-files.ts
- frontend/src/core/threads/hooks.ts
- frontend/src/core/threads/hooks.test.ts
- frontend/tests/e2e/input-and-compose.spec.ts
- .planning/phases/06-/06-UAT.md
autonomous: true
requirements:
- ATREF-01
- ATREF-02
- ATREF-03
- ATREF-04
---
<objective>
关闭 06-UAT 中的 4 个缺口候选位置、引用展示形态、上限与输入态保持、artifact 引用上下文可用性与任意输入位置 @ 触发。
</objective>
<context>
@.planning/phases/06-/06-UAT.md
@frontend/src/components/workspace/input-box.tsx
@frontend/src/components/ai-elements/prompt-input.tsx
@frontend/src/core/threads/submit-files.ts
@frontend/src/core/threads/hooks.ts
@frontend/src/core/threads/hooks.test.ts
@frontend/tests/e2e/input-and-compose.spec.ts
</context>
<tasks>
<task type="auto" tdd="true">
<name>Task 1: 修正 @ 候选定位与触发策略</name>
<action>
- 让候选列表始终紧贴输入区上方渲染(相对 textarea 锚点)。
- 在输入中的任意位置输入 `@` 都可触发候选,不再要求输入框空白态。
- 选择候选后保持 input 展开与焦点,不自动收起输入态。
</action>
<acceptance_criteria>
- `@` 在任意输入位置触发候选;
- 候选面板位置紧贴输入区上边缘;
- 点击候选后输入区保持可继续输入。
</acceptance_criteria>
</task>
<task type="auto" tdd="true">
<name>Task 2: 重构引用展示与数量约束</name>
<action>
- 将引用图片/文件预览渲染到 textarea 区域内,不再显示在 input 上方独立层。
- 不复用 `Tag` 组件,改为专用引用预览 UI。
- 引用上限改为 6并同步提示文案与测试断言。
</action>
<acceptance_criteria>
- 引用元素显示在 textarea 区域内;
- 代码中不再用 `Tag` 渲染引用;
- 第 7 个引用被阻止并提示“最多 6 个”。
</acceptance_criteria>
</task>
<task type="auto" tdd="true">
<name>Task 3: 对齐 artifact 引用上下文提交契约</name>
<action>
- 调整 `additional_kwargs.files` 中 artifact 引用结构,使其与后端“可作为上下文文件”的识别契约一致。
- 保持 upload 行为不回退,并补充单测覆盖 artifact/upload 两类上下文可用性差异。
</action>
<acceptance_criteria>
- artifact 引用在后续上下文中可用;
- upload 路径行为保持通过;
- hooks 单测覆盖并通过。
</acceptance_criteria>
</task>
</tasks>
<verification>
- `cd frontend && node --test src/core/threads/hooks.test.ts`
- `cd frontend && pnpm -s typecheck`
- `cd frontend && pnpm -s test:e2e --grep "DF-INPUT-007|DF-INPUT-008"`
</verification>
<output>
After completion, create `.planning/phases/06-/06-04-SUMMARY.md`
</output>

View File

@ -1,5 +1,5 @@
---
status: complete
status: diagnosed
phase: 06-
source:
- 06-01-SUMMARY.md
@ -62,26 +62,55 @@ blocked: 0
reason: "User reported: 出现的候选列表应该在紧贴在input的上方"
severity: cosmetic
test: 1
artifacts: []
missing: []
root_cause: "候选面板使用 `DropdownMenuContent` 默认定位,且未绑定输入框锚点/上边缘约束,导致面板位置与输入区视觉预期不一致。"
artifacts:
- path: "frontend/src/components/workspace/input-box.tsx"
issue: "mention dropdown positioned by generic menu behavior, not explicitly anchored above textarea"
missing:
- "将候选列表定位策略改为紧贴输入区上方(含滚动与窗口边界处理)"
debug_session: ""
- truth: "选择候选后,输入区显示可删除 chip重复选择同一文件不会重复新增可通过删除按钮或 Backspace 移除最后一个 chip。"
status: failed
reason: "User reported: 我希望引用的图片出现在textarea中而不是在input上方而且不要复用tag组件"
severity: major
test: 2
artifacts: []
missing: []
root_cause: "当前引用展示放在输入区外层绝对定位容器,并复用了 `Tag` 组件;未实现 textarea 内联引用预览组件。"
artifacts:
- path: "frontend/src/components/workspace/input-box.tsx"
issue: "references rendered in absolute `bottom-full` area using `Tag`"
- path: "frontend/src/components/ui/tag.tsx"
issue: "component reused for mention chips against UX requirement"
missing:
- "实现 textarea 内联引用卡片/图片缩略块"
- "替换 Tag 复用,使用专用引用 UI 组件"
debug_session: ""
- truth: "单条消息最多只能添加 10 个引用;尝试添加第 11 个时出现错误提示且不会新增。"
status: failed
reason: "User reported: 限制为6个。且点击后端列表的时候不要收起input"
severity: major
test: 3
artifacts: []
missing: []
root_cause: "上限常量硬编码为 10同时选择候选后调用 `setMentionOpen(false)` 并存在外部点击收起逻辑,导致输入态被打断。"
artifacts:
- path: "frontend/src/components/workspace/input-box.tsx"
issue: "`MAX_REFERENCES_PER_MESSAGE = 10` and mention selection closes dropdown/input focus"
missing:
- "上限从 10 改为 6 并同步提示文案"
- "选择候选后保持输入框展开与焦点,不自动收起"
debug_session: ""
- truth: "发送包含引用的消息后,消息成功进入对话流;引用对应的文件信息在后续上下文中可用。"
status: failed
reason: "User reported: 文件信息在上下文中不可用。当前系统未被当作上下文的传参是 artifact mention包含 ref_kind/ref_source上传文件会被当作上下文传参且在输入中的任何时候输入@都应出现候选列表,不应仅在输入框为空时出现。"
severity: major
test: 5
artifacts: []
missing: []
root_cause: "artifact 引用仅以前端构造的 `additional_kwargs.files` 元数据提交,缺少后端可解析的上下文绑定信号;另外 `@` 触发依赖当前 token 解析,未覆盖“任意输入位置”策略。"
artifacts:
- path: "frontend/src/core/threads/submit-files.ts"
issue: "references appended as metadata only; no backend-compatible context discriminator beyond ref_source"
- path: "frontend/src/core/threads/hooks.ts"
issue: "submit envelope does not include explicit artifact-context contract for backend resolution"
- path: "frontend/src/components/workspace/input-box.tsx"
issue: "mention trigger tied to `findMentionToken` result and closes when token not matched"
missing:
- "补充 artifact 引用的后端可消费上下文字段(与 uploads 对齐)"
- "确保任意输入位置输入 `@` 都可触发候选"
debug_session: ""