@@ -299,25 +351,21 @@ export function MessageBubble({ message, onNavigateToSubAgent }: MessageBubblePr
{taskResult.summary}
)}
- {taskResult ? (
- <>
-
-
-
-
- 点击查看子智能体输出
-
- >
- ) : isTaskTool && message.subagentTaskId ? (
+ {taskResult && (
+
+
+
+ )}
+ {isTaskTool && message.subagentTaskId && !taskResult && (
- ) : hasResult ? (
-
- 点击查看工具结果
-
- ) : (
+ )}
+ {!taskResult && !isTaskTool && !hasResult && (
- {isTaskTool ? '子智能体正在执行...' : '等待工具执行...'}
+ 等待工具执行...
+
+ )}
+ {isTaskTool && !taskResult && !message.subagentTaskId && (
+
+ 子智能体正在执行...
)}
>
diff --git a/web/src/hooks/useChat.ts b/web/src/hooks/useChat.ts
index 09edfb4..49c7340 100644
--- a/web/src/hooks/useChat.ts
+++ b/web/src/hooks/useChat.ts
@@ -14,6 +14,7 @@ import type {
TopicSummary,
Session,
TaskMessagesLoaded,
+ TaskStarted,
Attachment,
SchedulerJobList,
SchedulerJobSummary,
@@ -289,6 +290,22 @@ export function useChat(): UseChatReturn {
break
}
+ case 'task_started': {
+ const msg = message as TaskStarted
+ // 立即更新对应的 task tool_call,让用户可以点击查看实时进度
+ setMessages((prev) => {
+ for (let i = prev.length - 1; i >= 0; i--) {
+ if (prev[i].type === 'tool_call' && prev[i].toolName === 'task' && !prev[i].subagentTaskId) {
+ const updated = [...prev]
+ updated[i] = { ...updated[i], subagentTaskId: msg.task_id }
+ return updated
+ }
+ }
+ return prev
+ })
+ break
+ }
+
case 'session_list': {
const msg = message as SessionList
console.log('Session list received:', msg)
diff --git a/web/src/index.css b/web/src/index.css
index 4eae44b..8b1e012 100644
--- a/web/src/index.css
+++ b/web/src/index.css
@@ -149,6 +149,20 @@ body {
}
}
+@keyframes scale-in {
+ 0% {
+ opacity: 0;
+ transform: scale(0.5);
+ }
+ 50% {
+ transform: scale(1.1);
+ }
+ 100% {
+ opacity: 1;
+ transform: scale(1);
+ }
+}
+
.animate-slide-in {
animation: slide-in 0.3s ease-out;
}
@@ -157,6 +171,10 @@ body {
animation: fade-in 0.2s ease-out;
}
+.animate-scale-in {
+ animation: scale-in 0.3s ease-out;
+}
+
.typing-indicator span {
animation: typing-dot 1.4s infinite;
display: inline-block;
diff --git a/web/src/types/protocol.ts b/web/src/types/protocol.ts
index 3b3e7ee..eb5dd27 100644
--- a/web/src/types/protocol.ts
+++ b/web/src/types/protocol.ts
@@ -84,6 +84,13 @@ export interface WsError {
message: string
}
+export interface TaskStarted {
+ type: 'task_started'
+ task_id: string
+ description: string
+ subagent_type: string
+}
+
export interface SessionEstablished {
type: 'session_established'
session_id: string
@@ -203,6 +210,7 @@ export type WsOutbound =
| ToolResult
| ToolPending
| WsError
+ | TaskStarted
| SessionEstablished
| SessionCreated
| SessionList