diff --git a/src/frontend/src/components/IOview/index.tsx b/src/frontend/src/components/IOview/index.tsx new file mode 100644 index 000000000..85587f8eb --- /dev/null +++ b/src/frontend/src/components/IOview/index.tsx @@ -0,0 +1,93 @@ +import { ReactNode, useContext, useState } from "react"; +import NewChatView from "../newChatView"; +import { extractTypeFromLongId, removeCountFromString } from "../../utils/utils"; +import AccordionComponent from "../AccordionComponent"; +import { Badge } from "../ui/badge"; +import ShadTooltip from "../ShadTooltipComponent"; +import IconComponent from "../genericIconComponent"; +import { Textarea } from "../ui/textarea"; +import { NodeDataType } from "../../types/flow"; +import useFlowStore from "../../stores/flowStore"; +import useFlowsManagerStore from "../../stores/flowsManagerStore"; +import useFlowIOStore from "../../stores/flowsIOStore"; + + +export default function IOView(): JSX.Element { + const {inputIds, outputIds, updateNodeFlowData } = + useFlowIOStore(); + const { reactFlowInstance } = useFlowStore(); + const options = inputIds.concat(outputIds); + const [selectedView, setSelectedView] = useState(handleSelectChange(options[0])); + // if (outputTypes.includes("ChatOutput")) { + // return ; + // } + function handleSelectChange(selected: string) { + const type = extractTypeFromLongId(selected); + return + switch (type) { + case "ChatOutput": + return ; + break; + } + } + + + return ( +
+
+
+ + + Inputs + +
+ { + inputIds.filter(input=>extractTypeFromLongId(input)!=="ChatInput").map((inputId,index) => { + const nodeData:NodeDataType = reactFlowInstance?.getNodes().find(node=>node.id===inputId)?.data; + return ( +
+ + + {inputId} + +
{ + event.stopPropagation(); + }} + > +
+
+ } + key={index} + keyValue={inputId} + > +
+ +
+ +
+ ) + }) + } +
+ {selectedView} + + ); +} diff --git a/src/frontend/src/components/newChatView/chatInput/index.tsx b/src/frontend/src/components/newChatView/chatInput/index.tsx new file mode 100644 index 000000000..7ae0a0915 --- /dev/null +++ b/src/frontend/src/components/newChatView/chatInput/index.tsx @@ -0,0 +1,127 @@ +import { useEffect, useState } from "react"; +import IconComponent from "../../../components/genericIconComponent"; +import { Textarea } from "../../../components/ui/textarea"; +import { chatInputType } from "../../../types/components"; +import { classNames } from "../../../utils/utils"; + +export default function ChatInput({ + lockChat, + chatValue, + sendMessage, + setChatValue, + inputRef, + noInput, +}: chatInputType): JSX.Element { + const [repeate, setRepeate] = useState(1); + useEffect(() => { + if (!lockChat && inputRef.current) { + inputRef.current.focus(); + } + }, [lockChat, inputRef]); + + + function handleChange(value:number){ + console.log(value) + if(value>0){ + setRepeate(value); + } + else{ + setRepeate(1); + } + } + + + useEffect(() => { + if (inputRef.current) { + inputRef.current.style.height = "inherit"; // Reset the height + inputRef.current.style.height = `${inputRef.current.scrollHeight}px`; // Set it to the scrollHeight + } + }, [chatValue]); + + + return ( +
+
+ repeate + { + handleChange(parseInt(e.target.value)); + }} className="bg-background" type="number" min={0}/> + + +
+