fix: memories not visible when sending from outside io modal (#2987)
* Fixed names and unused params * Added refetch of memories
This commit is contained in:
parent
9ac861da2f
commit
83910866e9
3 changed files with 13 additions and 19 deletions
|
|
@ -21,7 +21,7 @@ import UploadFileButton from "./components/uploadFileButton";
|
||||||
import { getClassNamesFilePreview } from "./helpers/get-class-file-preview";
|
import { getClassNamesFilePreview } from "./helpers/get-class-file-preview";
|
||||||
import useAutoResizeTextArea from "./hooks/use-auto-resize-text-area";
|
import useAutoResizeTextArea from "./hooks/use-auto-resize-text-area";
|
||||||
import useFocusOnUnlock from "./hooks/use-focus-unlock";
|
import useFocusOnUnlock from "./hooks/use-focus-unlock";
|
||||||
export default function ChattInput({
|
export default function ChatInput({
|
||||||
lockChat,
|
lockChat,
|
||||||
chatValue,
|
chatValue,
|
||||||
sendMessage,
|
sendMessage,
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import { deleteFlowPool } from "../../../../controllers/API";
|
||||||
import useAlertStore from "../../../../stores/alertStore";
|
import useAlertStore from "../../../../stores/alertStore";
|
||||||
import useFlowStore from "../../../../stores/flowStore";
|
import useFlowStore from "../../../../stores/flowStore";
|
||||||
import useFlowsManagerStore from "../../../../stores/flowsManagerStore";
|
import useFlowsManagerStore from "../../../../stores/flowsManagerStore";
|
||||||
import { VertexBuildTypeAPI, sendAllProps } from "../../../../types/api";
|
import { VertexBuildTypeAPI } from "../../../../types/api";
|
||||||
import { ChatMessageType } from "../../../../types/chat";
|
import { ChatMessageType } from "../../../../types/chat";
|
||||||
import { FilePreviewType, chatViewProps } from "../../../../types/components";
|
import { FilePreviewType, chatViewProps } from "../../../../types/components";
|
||||||
import { classNames } from "../../../../utils/utils";
|
import { classNames } from "../../../../utils/utils";
|
||||||
|
|
@ -149,12 +149,7 @@ export default function ChatView({
|
||||||
const [files, setFiles] = useState<FilePreviewType[]>([]);
|
const [files, setFiles] = useState<FilePreviewType[]>([]);
|
||||||
const [isDragging, setIsDragging] = useState(false);
|
const [isDragging, setIsDragging] = useState(false);
|
||||||
|
|
||||||
const { dragOver, dragEnter, dragLeave } = useDragAndDrop(
|
const { dragOver, dragEnter, dragLeave } = useDragAndDrop(setIsDragging);
|
||||||
setIsDragging,
|
|
||||||
setFiles,
|
|
||||||
currentFlowId,
|
|
||||||
setErrorData,
|
|
||||||
);
|
|
||||||
|
|
||||||
const onDrop = (e) => {
|
const onDrop = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import {
|
||||||
useDeleteMessages,
|
useDeleteMessages,
|
||||||
useGetMessagesQuery,
|
useGetMessagesQuery,
|
||||||
} from "@/controllers/API/queries/messages";
|
} from "@/controllers/API/queries/messages";
|
||||||
import { useQueryClient } from "@tanstack/react-query";
|
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import AccordionComponent from "../../components/accordionComponent";
|
import AccordionComponent from "../../components/accordionComponent";
|
||||||
import IconComponent from "../../components/genericIconComponent";
|
import IconComponent from "../../components/genericIconComponent";
|
||||||
|
|
@ -22,7 +21,7 @@ import useFlowStore from "../../stores/flowStore";
|
||||||
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
||||||
import { useMessagesStore } from "../../stores/messagesStore";
|
import { useMessagesStore } from "../../stores/messagesStore";
|
||||||
import { IOModalPropsType } from "../../types/components";
|
import { IOModalPropsType } from "../../types/components";
|
||||||
import { NodeDataType, NodeType } from "../../types/flow";
|
import { NodeType } from "../../types/flow";
|
||||||
import { cn } from "../../utils/utils";
|
import { cn } from "../../utils/utils";
|
||||||
import BaseModal from "../baseModal";
|
import BaseModal from "../baseModal";
|
||||||
import IOFieldView from "./components/IOFieldView";
|
import IOFieldView from "./components/IOFieldView";
|
||||||
|
|
@ -158,15 +157,9 @@ export default function IOModal({
|
||||||
setSelectedTab(inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0);
|
setSelectedTab(inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0);
|
||||||
}, [allNodes.length]);
|
}, [allNodes.length]);
|
||||||
|
|
||||||
const flow_sessions = allNodes.map((node) => {
|
useEffect(() => {
|
||||||
if ((node.data as NodeDataType).node?.template["session_id"]) {
|
refetch();
|
||||||
return {
|
}, [open]);
|
||||||
id: node.id,
|
|
||||||
session_id: (node.data as NodeDataType).node?.template["session_id"]
|
|
||||||
.value,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const sessions = new Set<string>();
|
const sessions = new Set<string>();
|
||||||
|
|
@ -364,6 +357,7 @@ export default function IOModal({
|
||||||
{sessions.map((session, index) => {
|
{sessions.map((session, index) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
key={index}
|
||||||
className="file-component-accordion-div cursor-pointer"
|
className="file-component-accordion-div cursor-pointer"
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
@ -441,6 +435,11 @@ export default function IOModal({
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
{!sessions.length && (
|
||||||
|
<span className="text-sm text-muted-foreground">
|
||||||
|
No memories available.
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue