mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-05-01 17:50:44 +08:00
refactor: optimize task handling in message list
This commit is contained in:
@@ -92,18 +92,20 @@ export function MessageList({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (group.type === "assistant:subagent") {
|
} else if (group.type === "assistant:subagent") {
|
||||||
const tasks: Subtask[] = [];
|
const tasks = new Set<Subtask>();
|
||||||
for (const message of group.messages) {
|
for (const message of group.messages) {
|
||||||
if (message.type === "ai") {
|
if (message.type === "ai") {
|
||||||
for (const toolCall of message.tool_calls ?? []) {
|
for (const toolCall of message.tool_calls ?? []) {
|
||||||
if (toolCall.name === "task") {
|
if (toolCall.name === "task") {
|
||||||
updateSubtask({
|
const task: Subtask = {
|
||||||
id: toolCall.id!,
|
id: toolCall.id!,
|
||||||
subagent_type: toolCall.args.subagent_type,
|
subagent_type: toolCall.args.subagent_type,
|
||||||
description: toolCall.args.description,
|
description: toolCall.args.description,
|
||||||
prompt: toolCall.args.prompt,
|
prompt: toolCall.args.prompt,
|
||||||
status: "in_progress",
|
status: "in_progress",
|
||||||
});
|
};
|
||||||
|
updateSubtask(task);
|
||||||
|
tasks.add(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (message.type === "tool") {
|
} else if (message.type === "tool") {
|
||||||
@@ -152,13 +154,13 @@ export function MessageList({
|
|||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (tasks.length > 1) {
|
if (tasks.size > 1) {
|
||||||
results.push(
|
results.push(
|
||||||
<div
|
<div
|
||||||
key="subtask-count"
|
key="subtask-count"
|
||||||
className="text-muted-foreground font-norma pt-2 text-sm"
|
className="text-muted-foreground font-norma pt-2 text-sm"
|
||||||
>
|
>
|
||||||
{t.subtasks.executing(tasks.length)}
|
{t.subtasks.executing(tasks.size)}
|
||||||
</div>,
|
</div>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user