diff --git a/src/frontend/src/modals/formModal/fileComponent/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/fileComponent/index.tsx
similarity index 94%
rename from src/frontend/src/modals/formModal/fileComponent/index.tsx
rename to src/frontend/src/modals/IOModal/components/chatView/fileComponent/index.tsx
index b1dc74d1f..408e741c2 100644
--- a/src/frontend/src/modals/formModal/fileComponent/index.tsx
+++ b/src/frontend/src/modals/IOModal/components/chatView/fileComponent/index.tsx
@@ -1,7 +1,7 @@
import * as base64js from "base64-js";
import { useState } from "react";
-import IconComponent from "../../../components/genericIconComponent";
-import { fileCardPropsType } from "../../../types/components";
+import IconComponent from "../../../../../components/genericIconComponent";
+import { fileCardPropsType } from "../../../../../types/components";
export default function FileCard({
fileName,
diff --git a/src/frontend/src/components/newChatView/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/index.tsx
similarity index 87%
rename from src/frontend/src/components/newChatView/index.tsx
rename to src/frontend/src/modals/IOModal/components/chatView/index.tsx
index da811d376..36a17de47 100644
--- a/src/frontend/src/components/newChatView/index.tsx
+++ b/src/frontend/src/modals/IOModal/components/chatView/index.tsx
@@ -1,31 +1,32 @@
import { useEffect, useRef, useState } from "react";
-import IconComponent from "../../components/genericIconComponent";
-import { NOCHATOUTPUT_NOTICE_ALERT } from "../../constants/alerts_constants";
+import IconComponent from "../../../../components/genericIconComponent";
+import { NOCHATOUTPUT_NOTICE_ALERT } from "../../../../constants/alerts_constants";
import {
CHAT_FIRST_INITIAL_TEXT,
CHAT_SECOND_INITIAL_TEXT,
-} from "../../constants/constants";
-import { deleteFlowPool } from "../../controllers/API";
-import useAlertStore from "../../stores/alertStore";
-import useFlowStore from "../../stores/flowStore";
-import useFlowsManagerStore from "../../stores/flowsManagerStore";
-import { sendAllProps } from "../../types/api";
+} from "../../../../constants/constants";
+import { deleteFlowPool } from "../../../../controllers/API";
+import useAlertStore from "../../../../stores/alertStore";
+import useFlowStore from "../../../../stores/flowStore";
+import useFlowsManagerStore from "../../../../stores/flowsManagerStore";
+import { sendAllProps } from "../../../../types/api";
import {
ChatMessageType,
ChatOutputType,
FlowPoolObjectType,
-} from "../../types/chat";
-import { classNames } from "../../utils/utils";
+} from "../../../../types/chat";
+import { chatViewProps } from "../../../../types/components";
+import { classNames } from "../../../../utils/utils";
import ChatInput from "./chatInput";
import ChatMessage from "./chatMessage";
-export default function NewChatView({
+export default function ChatView({
sendMessage,
chatValue,
setChatValue,
lockChat,
setLockChat,
-}): JSX.Element {
+}: chatViewProps): JSX.Element {
const { flowPool, outputs, inputs, CleanFlowPool } = useFlowStore();
const { setNoticeData } = useAlertStore();
const currentFlowId = useFlowsManagerStore((state) => state.currentFlowId);
@@ -38,11 +39,11 @@ export default function NewChatView({
const outputTypes = outputs.map((obj) => obj.type);
const updateFlowPool = useFlowStore((state) => state.updateFlowPool);
- useEffect(() => {
- if (!outputTypes.includes("ChatOutput")) {
- setNoticeData({ title: NOCHATOUTPUT_NOTICE_ALERT });
- }
- }, []);
+ // useEffect(() => {
+ // if (!outputTypes.includes("ChatOutput")) {
+ // setNoticeData({ title: NOCHATOUTPUT_NOTICE_ALERT });
+ // }
+ // }, []);
//build chat history
useEffect(() => {
diff --git a/src/frontend/src/components/IOview/index.tsx b/src/frontend/src/modals/IOModal/index.tsx
similarity index 75%
rename from src/frontend/src/components/IOview/index.tsx
rename to src/frontend/src/modals/IOModal/index.tsx
index e0c81c979..38d2a48b1 100644
--- a/src/frontend/src/components/IOview/index.tsx
+++ b/src/frontend/src/modals/IOModal/index.tsx
@@ -1,36 +1,38 @@
import { useEffect, useState } from "react";
+import AccordionComponent from "../../components/AccordionComponent";
+import ShadTooltip from "../../components/ShadTooltipComponent";
+import IconComponent from "../../components/genericIconComponent";
+import { Badge } from "../../components/ui/badge";
+import { Button } from "../../components/ui/button";
+import {
+ Tabs,
+ TabsContent,
+ TabsList,
+ TabsTrigger,
+} from "../../components/ui/tabs";
import {
CHAT_FORM_DIALOG_SUBTITLE,
OUTPUTS_MODAL_TITLE,
TEXT_INPUT_MODAL_TITLE,
} from "../../constants/constants";
-import BaseModal from "../../modals/baseModal";
+import { InputOutput } from "../../constants/enums";
import useFlowStore from "../../stores/flowStore";
import useFlowsManagerStore from "../../stores/flowsManagerStore";
+import { IOModalPropsType } from "../../types/components";
import { NodeType } from "../../types/flow";
import { updateVerticesOrder } from "../../utils/buildUtils";
import { cn } from "../../utils/utils";
-import AccordionComponent from "../AccordionComponent";
-import IOInputField from "../IOInputField";
-import IOOutputView from "../IOOutputView";
-import ShadTooltip from "../ShadTooltipComponent";
-import IconComponent from "../genericIconComponent";
-import NewChatView from "../newChatView";
-import { Badge } from "../ui/badge";
-import { Button } from "../ui/button";
-import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs";
+import BaseModal from "../baseModal";
+import IOFieldView from "./components/IOFieldView";
+import ChatView from "./components/chatView";
-export default function IOView({
+export default function IOModal({
children,
open,
setOpen,
disable,
-}: {
- children: JSX.Element;
- open: boolean;
- setOpen: (open: boolean) => void;
- disable?: boolean;
-}): JSX.Element {
+}: IOModalPropsType): JSX.Element {
+ const allNodes = useFlowStore((state) => state.nodes);
const inputs = useFlowStore((state) => state.inputs).filter(
(input) => input.type !== "ChatInput"
);
@@ -52,9 +54,24 @@ export default function IOView({
const [selectedTab, setSelectedTab] = useState(
inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0
);
+
+ function startView() {
+ if (!chatInput && !chatOutput) {
+ if (inputs.length > 0) {
+ return inputs[0];
+ }
+ else {
+ return outputs[0];
+ }
+ }
+ else {
+ return undefined
+ }
+ }
+
const [selectedViewField, setSelectedViewField] = useState<
{ type: string; id: string } | undefined
- >(undefined);
+ >(startView());
const buildFlow = useFlowStore((state) => state.buildFlow);
const setIsBuilding = useFlowStore((state) => state.setIsBuilding);
@@ -99,19 +116,13 @@ export default function IOView({
}
useEffect(() => {
- setSelectedViewField(undefined);
+ setSelectedViewField(startView());
setSelectedTab(inputs.length > 0 ? 1 : outputs.length > 0 ? 2 : 0);
- }, [inputs.length, outputs.length]);
+ }, [allNodes]);
return (
{input && (
-
)}
@@ -230,7 +241,7 @@ export default function IOView({
className="api-modal-tabs-content mt-4"
>
-
+
{OUTPUTS_MODAL_TITLE}
{nodes
@@ -279,10 +290,11 @@ export default function IOView({
{output && (
-
)}
@@ -296,74 +308,81 @@ export default function IOView({
)}
- {haveChat || selectedViewField ? (
-
- {selectedViewField && (
-
-
-
- {selectedViewField.type}
-
-
- {inputs.some(
- (input) => input.id === selectedViewField.id
- ) ? (
-
- ) : (
-
- )}
-
-
- )}
+
+ {selectedViewField && (
-
+ {(haveChat && )}
+ {
+ nodes.find((node) => node.id === selectedViewField.id)
+ ?.data.node.display_name
+ }
+
+
+ {inputs.some(
+ (input) => input.id === selectedViewField.id
+ ) ? (
+
+ ) : (
+
+ )}
+
+
+ )}
+
+ {haveChat ? (
+
-
+ ) : (
+
+ Select an IO component to view
+
+ )}
- ) : (
-
- )}
+