From 359c05dd762e6b2d62293d240f69281d4c5a2eaa Mon Sep 17 00:00:00 2001 From: Utkarsh-Patel-13 Date: Sat, 19 Jul 2025 21:09:34 -0700 Subject: [PATCH] fixed rendering logic for terminal message to include all terminal messages --- .../researcher/[chat_id]/page.tsx | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/surfsense_web/app/dashboard/[search_space_id]/researcher/[chat_id]/page.tsx b/surfsense_web/app/dashboard/[search_space_id]/researcher/[chat_id]/page.tsx index 3c0f20d2c..8a0bde74f 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/researcher/[chat_id]/page.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/researcher/[chat_id]/page.tsx @@ -981,19 +981,16 @@ const ChatPage = () => { const renderTerminalContent = (message: any) => { if (!message.annotations) return null; - // Get all TERMINAL_INFO annotations - const terminalInfoAnnotations = (message.annotations as any[]).filter( - (a) => a.type === "TERMINAL_INFO", - ); - - // Get the latest TERMINAL_INFO annotation - const latestTerminalInfo = - terminalInfoAnnotations.length > 0 - ? terminalInfoAnnotations[terminalInfoAnnotations.length - 1] - : null; + // Get all TERMINAL_INFO annotations content + const terminalInfoAnnotations = (message.annotations as any[]).map(item => { + if(item.type === "TERMINAL_INFO") { + return item.content.map((a: any) => a.text) + + } + }).flat().filter(Boolean) // Render the content of the latest TERMINAL_INFO annotation - return latestTerminalInfo?.content.map((item: any, idx: number) => ( + return terminalInfoAnnotations.map((item: any, idx: number) => (
[{String(idx).padStart(2, "0")}: @@ -1008,7 +1005,7 @@ const ChatPage = () => { ${item.type === "warning" ? "text-yellow-300" : ""} `} > - {item.text} + {item}
));