diff --git a/langflow/frontend/src/App.tsx b/langflow/frontend/src/App.tsx index e34d24ac0..f0944be3f 100644 --- a/langflow/frontend/src/App.tsx +++ b/langflow/frontend/src/App.tsx @@ -8,7 +8,6 @@ import SuccessAlert from "./alerts/success"; import ExtraSidebar from "./components/ExtraSidebarComponent"; import { alertContext } from "./contexts/alertContext"; import { locationContext } from "./contexts/locationContext"; -import Header from "./components/HeaderComponent"; import TabsManagerComponent from "./pages/FlowPage/components/tabsManagerComponent"; export default function App() { @@ -85,7 +84,6 @@ useEffect(() => { //need parent component with width and height
-
@@ -97,7 +95,8 @@ useEffect(() => {
-
+
+
{alertsList.map((alert) => (
{alert.type === "error" ? ( @@ -127,6 +126,7 @@ useEffect(() => {
))}
+ Created by Logspace
); } diff --git a/langflow/frontend/src/CustomNodes/BooleanNode/index.tsx b/langflow/frontend/src/CustomNodes/BooleanNode/index.tsx deleted file mode 100644 index c22a9b972..000000000 --- a/langflow/frontend/src/CustomNodes/BooleanNode/index.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { CheckCircleIcon, TrashIcon } from "@heroicons/react/24/outline"; -import { Handle, Position } from "reactflow"; -import { isValidConnection, nodeColors } from "../../utils"; -import ToggleComponent from "../../components/toggleComponent"; -import { useContext, useState } from "react"; -import { typesContext } from "../../contexts/typesContext"; -import { NodeDataType } from "../../types/flow"; - -export default function BooleanNode({ data }:{data:NodeDataType}) { - const [enabled, setEnabled] = useState(false); - const {types, deleteNode, reactFlowInstance} = useContext(typesContext); - return ( -
-
-
- - Boolean -
- -
-
- {setEnabled(x); data.value = x}} /> -
- isValidConnection(connection,reactFlowInstance)} - className={"-mr-0.5 w-3 h-3 rounded-full border-2 bg-white dark:bg-gray-800"} - style={{ - borderColor: nodeColors[types[data.type]], - }} - > -
- ); -} diff --git a/langflow/frontend/src/CustomNodes/ChatInputNode/index.tsx b/langflow/frontend/src/CustomNodes/ChatInputNode/index.tsx deleted file mode 100644 index d579a2c07..000000000 --- a/langflow/frontend/src/CustomNodes/ChatInputNode/index.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { - Bars3CenterLeftIcon, -} from "@heroicons/react/24/outline"; -import { isValidConnection, nodeColors } from "../../utils"; -import { Handle, Position } from "reactflow"; -import Tooltip from "../../components/TooltipComponent"; -import { typesContext } from "../../contexts/typesContext"; -import { useContext } from "react"; -import { NodeDataType } from "../../types/flow"; - -export default function ChatInputNode({ data }:{data:NodeDataType}) { - const { types,reactFlowInstance } = useContext(typesContext); - return ( -
- - - isValidConnection(connection,reactFlowInstance) - } - position={Position.Left} - id={"str|Prefix|" + data.id} - className={"-ml-0.5 w-3 h-3 rounded-full border-2 bg-white dark:bg-gray-800"} - style={{ - borderColor: nodeColors[types[data.type]], - }} - > - - - - isValidConnection(connection,reactFlowInstance) - } - position={Position.Right} - id={"str|str|" + data.id} - className={"-mr-0.5 w-3 h-3 rounded-full border-2 bg-white dark:bg-gray-800"} - style={{ - borderColor: nodeColors[types[data.type]], - }} - > - -
- - Input -
-
- ); -} diff --git a/langflow/frontend/src/CustomNodes/ChatOutputNode/index.tsx b/langflow/frontend/src/CustomNodes/ChatOutputNode/index.tsx deleted file mode 100644 index ef3a435ca..000000000 --- a/langflow/frontend/src/CustomNodes/ChatOutputNode/index.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Bars3CenterLeftIcon } from "@heroicons/react/24/outline"; -import { Handle, Position } from "reactflow"; -import { isValidConnection, nodeColors } from "../../utils"; -import Tooltip from "../../components/TooltipComponent"; -import { useContext } from "react"; -import { typesContext } from "../../contexts/typesContext"; -import { NodeDataType } from "../../types/flow"; - -export default function ChatOutputNode({ data }:{data:NodeDataType}) { - const {types,reactFlowInstance} = useContext(typesContext); - return ( -
- - isValidConnection(connection,reactFlowInstance)} - position={Position.Left} - id={"str|output|"+data.id} - className={"-ml-0.5 w-3 h-3 rounded-full border-2 bg-white dark:bg-gray-800" - } - style={{ - borderColor: nodeColors[types[data.type]], - }} - > - - -
- Output - -
-
- ); -} diff --git a/langflow/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/langflow/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index 1fd43647f..3d43557d9 100644 --- a/langflow/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/langflow/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -1,8 +1,6 @@ import { Handle, Position, useUpdateNodeInternals } from "reactflow"; import Tooltip from "../../../../components/TooltipComponent"; -import { - isValidConnection, -} from "../../../../utils"; +import { classNames, isValidConnection } from "../../../../utils"; import { useContext, useEffect, useRef, useState } from "react"; import InputComponent from "../../../../components/inputComponent"; import ToggleComponent from "../../../../components/toggleComponent"; @@ -10,103 +8,127 @@ import InputListComponent from "../../../../components/inputListComponent"; import TextAreaComponent from "../../../../components/textAreaComponent"; import { typesContext } from "../../../../contexts/typesContext"; import { ParameterComponentType } from "../../../../types/components"; +import FloatComponent from "../../../../components/floatComponent"; export default function ParameterComponent({ - left, - id, - data, - tooltipTitle, - title, - color, - type, - name = "", - required = false, -}:ParameterComponentType) { - const ref = useRef(null); - const updateNodeInternals = useUpdateNodeInternals(); - const [position, setPosition] = useState(0); - useEffect(() => { - if (ref.current && ref.current.offsetTop && ref.current.clientHeight) { - setPosition(ref.current.offsetTop + ref.current.clientHeight / 2); - updateNodeInternals(data.id); - } - }, [data.id, ref, updateNodeInternals]); + left, + id, + data, + tooltipTitle, + title, + color, + type, + name = "", + required = false, +}: ParameterComponentType) { + const ref = useRef(null); + const updateNodeInternals = useUpdateNodeInternals(); + const [position, setPosition] = useState(0); + useEffect(() => { + if (ref.current && ref.current.offsetTop && ref.current.clientHeight) { + setPosition(ref.current.offsetTop + ref.current.clientHeight / 2); + updateNodeInternals(data.id); + } + }, [data.id, ref, updateNodeInternals]); - useEffect(() => { - updateNodeInternals(data.id); - }, [data.id, position, updateNodeInternals]); + useEffect(() => { + updateNodeInternals(data.id); + }, [data.id, position, updateNodeInternals]); - const [enabled, setEnabled] = useState(data.node.template[name]?.value ?? false); - const {reactFlowInstance} = useContext(typesContext); - let disabled = reactFlowInstance?.getEdges().some((e) => (e.targetHandle === id)) ?? false; + const [enabled, setEnabled] = useState( + data.node.template[name]?.value ?? false + ); + const { reactFlowInstance } = useContext(typesContext); + let disabled = + reactFlowInstance?.getEdges().some((e) => e.targetHandle === id) ?? false; - return ( -
- <> -
{title}{required ? " *" : ""}
- - - isValidConnection(connection,reactFlowInstance) - } - className={ - (left ? "-ml-0.5 " : "-mr-0.5 ") + - "w-3 h-3 rounded-full border-2 bg-white dark:bg-gray-800" - } - style={{ - borderColor: color, - top: position, - }} - > - - {left === true && type === "str" ? ( -
- {data.node.template[name].list ? - { - data.node.template[name].value = t; - }} - /> - : - data.node.template[name].multiline ? ( - { - data.node.template[name].value = t; - }} - /> - ) : - { - data.node.template[name].value = t; - }} - /> - } - -
- ) : left === true && type === "bool" ? ( -
- { - data.node.template[name].value = t; - setEnabled(t); - }} - /> -
- ) : ( - <> - )} - -
- ); + return ( +
+ <> +
+ {title} + {required ? " *" : ""} +
+ + + isValidConnection(connection, reactFlowInstance) + } + className={classNames( + left ? "-ml-0.5 " : "-mr-0.5 ", + "w-3 h-3 rounded-full border-2 bg-white dark:bg-gray-800", + left && (type === "str" || type === "bool" || type === "float") + ? "hidden" + : "" + )} + style={{ + borderColor: color, + top: position, + }} + > + + {left === true && type === "str" ? ( +
+ {data.node.template[name].list ? ( + { + data.node.template[name].value = t; + }} + /> + ) : data.node.template[name].multiline ? ( + { + data.node.template[name].value = t; + }} + /> + ) : ( + { + data.node.template[name].value = t; + }} + /> + )} +
+ ) : left === true && type === "bool" ? ( +
+ { + data.node.template[name].value = t; + setEnabled(t); + }} + /> +
+ ) : left === true && type === "float" ? ( + { + data.node.template[name].value = t; + }} + /> + ) : ( + <> + )} + +
+ ); } diff --git a/langflow/frontend/src/CustomNodes/GenericNode/index.tsx b/langflow/frontend/src/CustomNodes/GenericNode/index.tsx index 093a7bd6f..8e0773681 100644 --- a/langflow/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/langflow/frontend/src/CustomNodes/GenericNode/index.tsx @@ -2,6 +2,7 @@ import { TrashIcon, } from "@heroicons/react/24/outline"; import { + classNames, nodeColors, nodeIcons, snakeToNormalCase, @@ -11,13 +12,13 @@ import { typesContext } from "../../contexts/typesContext"; import { useContext } from "react"; import { NodeDataType} from "../../types/flow"; -export default function GenericNode({ data}:{data:NodeDataType}) { +export default function GenericNode({ data, selected}:{data:NodeDataType,selected:boolean}) { const {types, deleteNode} = useContext(typesContext); const Icon = nodeIcons[types[data.type]]; return ( -
+
- - - isValidConnection(connection,reactFlowInstance) - } - className={"-ml-0.5 w-3 h-3 rounded-full border-2 bg-white dark:bg-gray-800"} - style={{ - borderColor: nodeColors[types[data.type]], - }} - > - - -
-
- - String -
- -
-
- - { - data.value = e; - }} - /> -
- isValidConnection(connection,reactFlowInstance)} - className={"-mr-0.5 w-3 h-3 rounded-full border-2 bg-white dark:bg-gray-800"} - style={{ - borderColor: nodeColors[types[data.type]], - }} - > -
- ); -} diff --git a/langflow/frontend/src/alerts/alertDropDown/components/singleAlertComponent/index.tsx b/langflow/frontend/src/alerts/alertDropDown/components/singleAlertComponent/index.tsx index b627c5fa5..61965929d 100644 --- a/langflow/frontend/src/alerts/alertDropDown/components/singleAlertComponent/index.tsx +++ b/langflow/frontend/src/alerts/alertDropDown/components/singleAlertComponent/index.tsx @@ -22,7 +22,7 @@ export default function SingleAlert({ dropItem, removeAlert}:SingleAlertComponen leaveTo={"transform translate-x-[-100%]"} > {type === "error"? -
+
:(type === "notice" ? -
+
: -
+
-
-
+
+
Notifications -
+
-
+
{notificationList.length !== 0 ? notificationList.map((alertItem, index) => ( - + )) :
@@ -59,6 +50,5 @@ export default function AlertDropdown({closeFunction, open}: AlertDropdownType) }
- ); } diff --git a/langflow/frontend/src/components/ExtraSidebarComponent/index.tsx b/langflow/frontend/src/components/ExtraSidebarComponent/index.tsx index 7a112fd29..f5acd5a23 100644 --- a/langflow/frontend/src/components/ExtraSidebarComponent/index.tsx +++ b/langflow/frontend/src/components/ExtraSidebarComponent/index.tsx @@ -17,12 +17,12 @@ export default function ExtraSidebar() { <>