Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: memories not visible when sending from outside io modal #2987

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 2 additions & 7 deletions src/frontend/src/modals/IOModal/components/chatView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -149,12 +149,7 @@ export default function ChatView({
const [files, setFiles] = useState<FilePreviewType[]>([]);
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();
Expand Down
21 changes: 10 additions & 11 deletions src/frontend/src/modals/IOModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down Expand Up @@ -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<string>();
Expand Down Expand Up @@ -364,6 +357,7 @@ export default function IOModal({
{sessions.map((session, index) => {
return (
<div
key={index}
className="file-component-accordion-div cursor-pointer"
onClick={(event) => {
event.stopPropagation();
Expand Down Expand Up @@ -441,6 +435,11 @@ export default function IOModal({
</div>
);
})}
{!sessions.length && (
<span className="text-sm text-muted-foreground">
No memories available.
</span>
)}
</TabsContent>
</Tabs>
</div>
Expand Down
Loading