Skip to content

feat(ask): float, drag, or collapse the blocking question card - #623

Open
yunsheng111 wants to merge 1 commit into
xintaofei:mainfrom
yunsheng111:feat/ask-question-card-collapse-drag
Open

feat(ask): float, drag, or collapse the blocking question card#623
yunsheng111 wants to merge 1 commit into
xintaofei:mainfrom
yunsheng111:feat/ask-question-card-collapse-drag

Conversation

@yunsheng111

Copy link
Copy Markdown

feat(ask): float, drag, or collapse the blocking question card

Closes #622 (extends the earlier #285 "挡字" fix)

问题

#285 关闭后,提问卡被限制为 max-h-[88svh] + 内部滚动,但卡片仍悬浮在输入框上方,挤压消息列表的可见区域。长对话中用户看不到自己正在回复的消息流,且卡片没有任何收起/移开的手段,只能等 Agent 提交或跳过。

改动

AskQuestionCard 新增两个互不影响的布局控制,把面板空间交还给用户:

  1. 折叠 (Collapse) — 一键收缩为仅标题行(chevron 展开/收起),问题保持 pending 可见;
  2. 浮窗 (Float, Picture-in-Picture)createPortal 把卡片从消息流取出,变成视口固定、可拖拽的迷你窗口;拖拽全程按 8px 安全边距 clamp 在视口内,setPointerCapture 保证拖出卡片不丢事件;再点一次停回面板。

细节:

  • 折叠/浮窗状态在换题(question-set swap)时保留——用户选的布局不因新题目重置;
  • 只读/已作答视图(消息流记录卡)不显示控件;
  • 13 个语言文件新增 collapse / expand / float / dock 文案;
  • 新增 30 个单测:折叠切换、浮窗开合、拖拽 clamp、换题状态保留、只读视图无控件等。

验证

  • vitest run src/components/chat/ask-question-card.test.tsx → 30/30 passed
  • 提交 blob 为 LF(与仓库一致);本地 eslint 报错仅源于 Windows core.autocrlf 工作树行尾,提交内容无 CRLF
  • i18n 全部 13 个 JSON 校验合法,与上游 rebase 后无键冲突(上游新键全保留)

变更文件

  • src/components/chat/ask-question-card.tsx(+~280 行:折叠/浮窗/拖拽)
  • src/components/chat/ask-question-card.test.tsx(+115 行)
  • src/i18n/messages/{ar,de,en,es,fr,ja,ko,pt,zh-CN,zh-TW}.json(每语言 +4 键)

讨论点

若作者更倾向只做折叠、或把浮窗改成侧边栏挂靠,可以本 PR 为起点调整。

The ask_user_question card sits over the composer and squeezes the
message list. Let the user reclaim the panel:

- Float: detach the card into a viewport-fixed, draggable mini window
  via createPortal, clamped to the window on every move.
- Collapse: shrink the live card to its header with a chevron; keep
  the pending question visible so an agent blocked on an answer is
  never hidden outright.
- Both states survive a question-set swap on the same instance, and
  are skipped in the read-only/answered view.
- 13 locales gain collapse/expand/float/dock strings.

Refs: xintaofei#285
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

【建议】ask_user_question 卡片支持折叠与浮窗(可拖拽),避免遮挡对话面板

1 participant