@@ -104,21 +104,24 @@ const ActivityListItem = React.memo(({ messageId }: { messageId: string }) => {
104104 const message = useMessage ( messageId ) ;
105105 if ( message ) {
106106 if ( ! message . isStreaming && message . toolCalls ?. length ) {
107- for ( const toolCall of message . toolCalls ) {
108- if ( typeof toolCall . result === "string" && toolCall . result ?. startsWith ( "Error" ) ) {
109- return null ;
110- }
111- if ( toolCall . name === "web_search" ) {
112- return < WebSearchToolCall key = { toolCall . id } toolCall = { toolCall } /> ;
113- } else if ( toolCall . name === "crawl_tool" ) {
114- return < CrawlToolCall key = { toolCall . id } toolCall = { toolCall } /> ;
115- } else if ( toolCall . name === "python_repl_tool" ) {
116- return < PythonToolCall key = { toolCall . id } toolCall = { toolCall } /> ;
117- } else if ( toolCall . name === "local_search_tool" ) {
118- return < RetrieverToolCall key = { toolCall . id } toolCall = { toolCall } /> ;
119- } else {
120- return < MCPToolCall key = { toolCall . id } toolCall = { toolCall } /> ;
121- }
107+ const toolCallComponents = message . toolCalls
108+ . filter ( toolCall => ! ( typeof toolCall . result === "string" && toolCall . result ?. startsWith ( "Error" ) ) )
109+ . map ( toolCall => {
110+ if ( toolCall . name === "web_search" ) {
111+ return < WebSearchToolCall key = { toolCall . id } toolCall = { toolCall } /> ;
112+ } else if ( toolCall . name === "crawl_tool" ) {
113+ return < CrawlToolCall key = { toolCall . id } toolCall = { toolCall } /> ;
114+ } else if ( toolCall . name === "python_repl_tool" ) {
115+ return < PythonToolCall key = { toolCall . id } toolCall = { toolCall } /> ;
116+ } else if ( toolCall . name === "local_search_tool" ) {
117+ return < RetrieverToolCall key = { toolCall . id } toolCall = { toolCall } /> ;
118+ } else {
119+ return < MCPToolCall key = { toolCall . id } toolCall = { toolCall } /> ;
120+ }
121+ } ) ;
122+
123+ if ( toolCallComponents . length > 0 ) {
124+ return < > { toolCallComponents } </ > ;
122125 }
123126 }
124127 }
0 commit comments