diff --git a/frontend/src/app/chat/page.tsx b/frontend/src/app/chat/page.tsx index 3730a4a2..8ec9d28b 100644 --- a/frontend/src/app/chat/page.tsx +++ b/frontend/src/app/chat/page.tsx @@ -479,7 +479,7 @@ function ChatPage() { console.log("🔵 Looking for existing function calls:", currentFunctionCalls.map(fc => ({ id: fc.id, name: fc.name }))) // Find existing function call by ID or name - let functionCall = currentFunctionCalls.find(fc => + const functionCall = currentFunctionCalls.find(fc => fc.id === chunk.item.id || fc.name === chunk.item.tool_name || fc.name === chunk.item.name @@ -529,7 +529,7 @@ function ChatPage() { } } else { // Create new function call if not found - functionCall = { + const newFunctionCall = { name: chunk.item.tool_name || chunk.item.name || chunk.item.type || "unknown", arguments: chunk.item.inputs || {}, status: "completed" as const, @@ -537,7 +537,7 @@ function ChatPage() { type: chunk.item.type, result: chunk.item.results } - currentFunctionCalls.push(functionCall) + currentFunctionCalls.push(newFunctionCall) } } @@ -850,7 +850,17 @@ function ChatPage() { resultsToRender = fc.result[0].results } - return resultsToRender.map((result: any, idx: number) => ( + type ToolResultItem = { + text_key?: string + data?: { file_path?: string; text?: string } + filename?: string + page?: number + score?: number + source_url?: string | null + text?: string + } + const items = resultsToRender as unknown as ToolResultItem[] + return items.map((result, idx: number) => (