Skip to content

feat(chat): 用输入框上方的排队消息预览条替代占位消息#146

Open
SsparKluo wants to merge 1 commit into
lehhair:mainfrom
SsparKluo:feat/queue-message-input-bar
Open

feat(chat): 用输入框上方的排队消息预览条替代占位消息#146
SsparKluo wants to merge 1 commit into
lehhair:mainfrom
SsparKluo:feat/queue-message-input-bar

Conversation

@SsparKluo

@SsparKluo SsparKluo commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

背景

之前开启"后续消息排队"后,用户在 AI 生成中发送消息时,队列会往 messageStore 里插入一条 UserMessageView 占位消息——和真实已发送的消息外观完全一样。用户无法分辨"已发送等回复"还是"还在排队没发出去"。

改动

将隐形的占位消息方案替换为输入框上方的排队消息预览条。排队消息留在队列中,只有在真正发送后才出现在聊天区。

新增文件:

  • src/features/chat/input/QueuedMessagesBar.tsx — 输入框上方的排队消息预览条
    • 毛玻璃样式(glass),与项目其他悬浮层一致
    • 每条消息独立一行,文本溢出截断 + hover tooltip 展示全文
    • 状态指示:排队中(⏱)、发送中(旋转动画)、失败(红色标记)
    • 立即发送按钮,跳过队列直接发送
    • 删除按钮(×),可取消排队或放弃失败项
    • 入场动画(usePresence

src/hooks/useChatSession.ts

  • 移除 buildLocalQueuedMessage(~80 行占位消息构造逻辑)
  • 移除入队时的 messageStore.upsertLocalMessage 调用(不再往消息列表塞假消息)
  • 移除 sendQueuedFollowup 中的 messageStore.removeMessage 清理
  • 新增 handleSendQueuedNow——立即从队列移除并直接走 sendMessageNow
  • handleAbort 中增加 followupQueueStore.clearSession——中止生成同时清空队列

src/features/chat/ChatPane.tsx — 将排队相关 props 传入 InputBox

src/features/chat/InputBox.tsx — 在展开态渲染 QueuedMessagesBar,折叠态隐藏

src/features/chat/input/InputActions.tsxCollapsedCapsule 新增排队计数 badge

src/locales/en|zh-CN/chat.json — 排队消息相关翻译

效果

折叠状态:

         [↑ Reply ②]   [↓]           ← 只显示计数 badge

展开状态:

┌──────────────────────────────────────────┐
│ ⏱ Fix the test that should pass when… →×│ ← glass 毛玻璃预览条
│ ⏱ Add error handling for the new en… →×│
├──────────────────────────────────────────┤
│ [textarea...                            ]│
│ [Agent] [Model]                 [Send]  │
└──────────────────────────────────────────┘

@SsparKluo
SsparKluo marked this pull request as ready for review July 21, 2026 08:44
@SsparKluo
SsparKluo marked this pull request as draft July 21, 2026 10:15
@SsparKluo
SsparKluo force-pushed the feat/queue-message-input-bar branch from 10c2e54 to e7ba196 Compare July 21, 2026 10:35
@SsparKluo
SsparKluo force-pushed the feat/queue-message-input-bar branch from e7ba196 to bf61aef Compare July 21, 2026 10:35
@SsparKluo
SsparKluo marked this pull request as ready for review July 21, 2026 10:39
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.

1 participant