From 83910866e9f48e849dbe4ec2d425cdbca4b4150a Mon Sep 17 00:00:00 2001 From: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:07:40 -0300 Subject: [PATCH] fix: memories not visible when sending from outside io modal (#2987) * Fixed names and unused params * Added refetch of memories --- .../components/chatView/chatInput/index.tsx | 2 +- .../IOModal/components/chatView/index.tsx | 9 ++------ src/frontend/src/modals/IOModal/index.tsx | 21 +++++++++---------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/frontend/src/modals/IOModal/components/chatView/chatInput/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/chatInput/index.tsx index c9db7b6da..3a52fc535 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/chatInput/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/chatInput/index.tsx @@ -21,7 +21,7 @@ import UploadFileButton from "./components/uploadFileButton"; import { getClassNamesFilePreview } from "./helpers/get-class-file-preview"; import useAutoResizeTextArea from "./hooks/use-auto-resize-text-area"; import useFocusOnUnlock from "./hooks/use-focus-unlock"; -export default function ChattInput({ +export default function ChatInput({ lockChat, chatValue, sendMessage, diff --git a/src/frontend/src/modals/IOModal/components/chatView/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/index.tsx index 422f0f8e1..f9d771fea 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/index.tsx @@ -14,7 +14,7 @@ import { deleteFlowPool } from "../../../../controllers/API"; import useAlertStore from "../../../../stores/alertStore"; import useFlowStore from "../../../../stores/flowStore"; import useFlowsManagerStore from "../../../../stores/flowsManagerStore"; -import { VertexBuildTypeAPI, sendAllProps } from "../../../../types/api"; +import { VertexBuildTypeAPI } from "../../../../types/api"; import { ChatMessageType } from "../../../../types/chat"; import { FilePreviewType, chatViewProps } from "../../../../types/components"; import { classNames } from "../../../../utils/utils"; @@ -149,12 +149,7 @@ export default function ChatView({ const [files, setFiles] = useState([]); const [isDragging, setIsDragging] = useState(false); - const { dragOver, dragEnter, dragLeave } = useDragAndDrop( - setIsDragging, - setFiles, - currentFlowId, - setErrorData, - ); + const { dragOver, dragEnter, dragLeave } = useDragAndDrop(setIsDragging); const onDrop = (e) => { e.preventDefault(); diff --git a/src/frontend/src/modals/IOModal/index.tsx b/src/frontend/src/modals/IOModal/index.tsx index 4998fe8ef..2df027e81 100644 --- a/src/frontend/src/modals/IOModal/index.tsx +++ b/src/frontend/src/modals/IOModal/index.tsx @@ -2,7 +2,6 @@ import { useDeleteMessages, useGetMessagesQuery, } from "@/controllers/API/queries/messages"; -import { useQueryClient } from "@tanstack/react-query"; import { useEffect, useState } from "react"; import AccordionComponent from "../../components/accordionComponent"; import IconComponent from "../../components/genericIconComponent"; @@ -22,7 +21,7 @@ import useFlowStore from "../../stores/flowStore"; import useFlowsManagerStore from "../../stores/flowsManagerStore"; import { useMessagesStore } from "../../stores/messagesStore"; import { IOModalPropsType } from "../../types/components"; -import { NodeDataType, NodeType } from "../../types/flow"; +import { NodeType } from "../../types/flow"; import { cn } from "../../utils/utils"; import BaseModal from "../baseModal"; import IOFieldView from "./components/IOFieldView"; @@ -158,15 +157,9 @@ export default function IOModal({ setSelectedTab(inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0); }, [allNodes.length]); - const flow_sessions = allNodes.map((node) => { - if ((node.data as NodeDataType).node?.template["session_id"]) { - return { - id: node.id, - session_id: (node.data as NodeDataType).node?.template["session_id"] - .value, - }; - } - }); + useEffect(() => { + refetch(); + }, [open]); useEffect(() => { const sessions = new Set(); @@ -364,6 +357,7 @@ export default function IOModal({ {sessions.map((session, index) => { return (
{ event.stopPropagation(); @@ -441,6 +435,11 @@ export default function IOModal({
); })} + {!sessions.length && ( + + No memories available. + + )}