diff --git a/frontend/src/features/chat/components/ChatWindow.js b/frontend/src/features/chat/components/ChatWindow.js
index a7c194a..a20fe20 100644
--- a/frontend/src/features/chat/components/ChatWindow.js
+++ b/frontend/src/features/chat/components/ChatWindow.js
@@ -315,7 +315,9 @@
};
// Main ChatWindow component with dynamic height calculation
-const ChatWindow = ({ chatHistory, maxHeight, onSynthesize, featureName, isStreamingPlaying, onAudioPlay, autoCollapse = false, evaluationMetadata }) => {
+const ChatWindow = ({ messages, chatHistory, maxHeight, onSynthesize, featureName, isStreamingPlaying, onAudioPlay, autoCollapse = false, evaluationMetadata }) => {
+ const history = chatHistory || messages || [];
+
const containerRef = useRef(null);
const [activePlayingId, setActivePlayingId] = useState(null);
const [expandedIndices, setExpandedIndices] = useState({});
@@ -361,7 +363,7 @@
}
});
}
- }, [chatHistory, evaluationMetadata]);
+ }, [history, evaluationMetadata]);
return (
{(() => {
- const lastAssistantIndex = chatHistory.slice().reverse().findIndex(m => m.sender === 'assistant' || m.sender === 'assistant'); // Logic for assistant
- const actualLastAssistantIndex = lastAssistantIndex !== -1 ? chatHistory.length - 1 - lastAssistantIndex : -1;
+ const lastAssistantIndex = history.slice().reverse().findIndex(m => m.sender === 'assistant' || m.sender === 'assistant'); // Logic for assistant
+ const actualLastAssistantIndex = lastAssistantIndex !== -1 ? history.length - 1 - lastAssistantIndex : -1;
- return chatHistory.map((message, index) => {
- const isLastMessage = index === chatHistory.length - 1;
+ return history.map((message, index) => {
+ const isLastMessage = index === history.length - 1;
const isLastAssistantMessage = index === actualLastAssistantIndex;
const isSystemLog = message.sender === "system" && (message.text?.includes("Co-Worker") || message.text?.includes("Attempt"));
const shouldCollapse = (autoCollapse && !isLastMessage && !message.isUser && !expandedIndices[index]) || (isSystemLog && !expandedIndices[index]);