Skip to content

【已审核】fix(agent): 后台任务运行时显示视觉提示#1025

Open
climashscape wants to merge 1 commit into
proma-ai:mainfrom
climashscape:fix/issue-02-background-task-ui
Open

【已审核】fix(agent): 后台任务运行时显示视觉提示#1025
climashscape wants to merge 1 commit into
proma-ai:mainfrom
climashscape:fix/issue-02-background-task-ui

Conversation

@climashscape

Copy link
Copy Markdown
Contributor

概述

修复 Agent 后台任务(backgroundWaiting)运行期间 UI 显示为"已完成"状态的问题。原实现中 agentSessionIndicatorMapAtom 未覆盖 backgroundWaiting,导致侧边栏指示点变灰、Tab 标题无 spinner、输入区显示 Send 按钮——与 Agent 彻底跑完后无法区分,用户易误切走或发新消息打断后台进度。

改动

  • apps/electron/src/renderer/atoms/agent-atoms.ts (+9/-6)
    • agentSessionIndicatorMapAtom 纳入 backgroundWaiting,映射为 'running',侧边栏指示点显示蓝色脉冲(与 running 同态)
    • 删除死代码 agentRunningSessionIdsAtom(改用 indicator map 后无消费者)
  • apps/electron/src/renderer/atoms/tab-atoms.ts (+3/-3)
    • tabStreamingMapAtom 改派生自 indicator map,Tab 标题通过 showAgentSpinner 显示 spinner
  • apps/electron/src/renderer/components/agent/AgentView.tsx (+16/-1)
    • 输入区 trailing 在 backgroundWaiting 且无输入文本时显示"后台任务运行中"蓝色徽标
    • 用户开始输入后让出位置给 Send 按钮,保证后台任务期间可正常发新消息(走注入通道)

测试

  1. bun run typecheck 通过
  2. bun run dev 启动应用
  3. 对 Agent 说"帮我在后台跑一个长时间任务"
  4. 验证:
    • 侧边栏会话指示点为蓝色脉冲(不是灰色)
    • Tab 栏会话标题显示** spinner**
    • 输入区右下角显示**"后台任务运行中"蓝色徽标**(无输入文本时)
    • 开始输入后徽标让位给 Send 按钮,可正常发新消息(走注入通道,不打断后台任务)

紧急度

后台任务状态盲区会导致用户误切走(错过 Agent 唤醒后的后续输出)或误发新消息(打断后台进度),影响多数使用 Agent 后台任务的用户的核心工作流。

备注

Closes #1013

backgroundWaiting 状态下用户无法区分 Agent 是彻底完成还是在后台跑任务,
容易误切走或发新消息打断进度。

- agent-atoms.ts: agentSessionIndicatorMapAtom 纳入 backgroundWaiting,
  映射为 'running',侧边栏指示点显示蓝色脉冲(与 running 同态)
- tab-atoms.ts: tabStreamingMapAtom 改派生自 indicator map,
  Tab 标题通过 showAgentSpinner 显示 spinner
- AgentView.tsx: 输入区 trailing 在 backgroundWaiting 且无输入文本时
  显示 '后台任务运行中' 蓝色徽标;用户开始输入后让出位置给 Send 按钮,
  保证后台任务期间可正常发新消息(走注入通道)
- 清理死代码:删除 agentRunningSessionIdsAtom(改用 indicator map 后无消费者)

改动文件:
- apps/electron/src/renderer/atoms/agent-atoms.ts
- apps/electron/src/renderer/atoms/tab-atoms.ts
- apps/electron/src/renderer/components/agent/AgentView.tsx
(+24/-14 行)
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.

Agent 后台任务运行时 UI 显示为已完成状态

1 participant