diff --git a/web/src/app/chat/components/research-activities-block.tsx b/web/src/app/chat/components/research-activities-block.tsx index ef808d3..b3ba900 100644 --- a/web/src/app/chat/components/research-activities-block.tsx +++ b/web/src/app/chat/components/research-activities-block.tsx @@ -104,21 +104,24 @@ const ActivityListItem = React.memo(({ messageId }: { messageId: string }) => { const message = useMessage(messageId); if (message) { if (!message.isStreaming && message.toolCalls?.length) { - for (const toolCall of message.toolCalls) { - if (typeof toolCall.result === "string" && toolCall.result?.startsWith("Error")) { - return null; - } - if (toolCall.name === "web_search") { - return ; - } else if (toolCall.name === "crawl_tool") { - return ; - } else if (toolCall.name === "python_repl_tool") { - return ; - } else if (toolCall.name === "local_search_tool") { - return ; - } else { - return ; - } + const toolCallComponents = message.toolCalls + .filter(toolCall => !(typeof toolCall.result === "string" && toolCall.result?.startsWith("Error"))) + .map(toolCall => { + if (toolCall.name === "web_search") { + return ; + } else if (toolCall.name === "crawl_tool") { + return ; + } else if (toolCall.name === "python_repl_tool") { + return ; + } else if (toolCall.name === "local_search_tool") { + return ; + } else { + return ; + } + }); + + if (toolCallComponents.length > 0) { + return <>{toolCallComponents}; } } }