diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/StatusResponse/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/StatusResponse/index.jsx
deleted file mode 100644
index c06fb35a..00000000
--- a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/StatusResponse/index.jsx
+++ /dev/null
@@ -1,113 +0,0 @@
-import React, { useState } from "react";
-import {
- CaretDown,
- CircleNotch,
- Check,
- CheckCircle,
-} from "@phosphor-icons/react";
-
-export default function StatusResponse({
- messages = [],
- isThinking = false,
- showCheckmark = false,
-}) {
- const [isExpanded, setIsExpanded] = useState(false);
- const currentThought = messages[messages.length - 1];
- const previousThoughts = messages.slice(0, -1);
-
- function handleExpandClick() {
- if (!previousThoughts.length > 0) return;
- setIsExpanded(!isExpanded);
- }
-
- return (
-
- {compiledHistory.map((item, index) =>
- Array.isArray(item) ? renderStatusResponse(item, index) : item
- )}
+ {history.map((props, index) => {
+ const isLastBotReply =
+ index === history.length - 1 && props.role === "assistant";
+
+ if (props?.type === "statusResponse" && !!props.content) {
+ return
;
+ }
+
+ if (props.type === "rechartVisualize" && !!props.content) {
+ return (
+
+ );
+ }
+
+ if (isLastBotReply && props.animate) {
+ return (
+
+ );
+ }
+
+ return (
+
+ );
+ })}
{showing && (
)}
@@ -244,13 +253,21 @@ export default function ChatHistory({
);
}
-const getLastMessageInfo = (history) => {
- const lastMessage = history?.[history.length - 1] || {};
- return {
- isAnimating: lastMessage?.animate,
- isStatusResponse: lastMessage?.type === "statusResponse",
- };
-};
+function StatusResponse({ props }) {
+ return (
+
+
+
+
+ {props.content}
+
+
+
+
+ );
+}
function WorkspaceChatSuggestions({ suggestions = [], sendSuggestion }) {
if (suggestions.length === 0) return null;
@@ -269,78 +286,3 @@ function WorkspaceChatSuggestions({ suggestions = [], sendSuggestion }) {
);
}
-
-/**
- * Builds the history of messages for the chat.
- * This is mostly useful for rendering the history in a way that is easy to understand.
- * as well as compensating for agent thinking and other messages that are not part of the history, but
- * are still part of the chat.
- *
- * @param {Object} param0 - The parameters for building the messages.
- * @param {Array} param0.history - The history of messages.
- * @param {Object} param0.workspace - The workspace object.
- * @param {Function} param0.regenerateAssistantMessage - The function to regenerate the assistant message.
- * @param {Function} param0.saveEditedMessage - The function to save the edited message.
- * @param {Function} param0.forkThread - The function to fork the thread.
- * @returns {Array} The compiled history of messages.
- */
-function buildMessages({
- history,
- workspace,
- regenerateAssistantMessage,
- saveEditedMessage,
- forkThread,
-}) {
- return history.reduce((acc, props, index) => {
- const isLastBotReply =
- index === history.length - 1 && props.role === "assistant";
-
- if (props?.type === "statusResponse" && !!props.content) {
- if (acc.length > 0 && Array.isArray(acc[acc.length - 1])) {
- acc[acc.length - 1].push(props);
- } else {
- acc.push([props]);
- }
- return acc;
- }
-
- if (props.type === "rechartVisualize" && !!props.content) {
- acc.push(
-