diff --git a/langflow/frontend/public/index.html b/langflow/frontend/public/index.html index e9ecbe8ec..aa19f07de 100644 --- a/langflow/frontend/public/index.html +++ b/langflow/frontend/public/index.html @@ -4,7 +4,7 @@ - Document + LangFLow diff --git a/langflow/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/langflow/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index 3d43557d9..facf6237a 100644 --- a/langflow/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/langflow/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -52,6 +52,9 @@ export default function ParameterComponent({ {title} {required ? " *" : ""} + {left && (type === "str" || type === "bool" || type === "float") ? + <> + : + } + {left === true && type === "str" ? (
{data.node.template[name].list ? ( @@ -99,6 +101,7 @@ export default function ParameterComponent({ ) : ( { data.node.template[name].value = t; diff --git a/langflow/frontend/src/components/chatComponent/index.tsx b/langflow/frontend/src/components/chatComponent/index.tsx index 00a278037..4cf6dcd82 100644 --- a/langflow/frontend/src/components/chatComponent/index.tsx +++ b/langflow/frontend/src/components/chatComponent/index.tsx @@ -5,7 +5,7 @@ import { PaperAirplaneIcon, XMarkIcon, } from "@heroicons/react/24/outline"; -import { useContext, useEffect, useRef, useState } from "react"; +import { MouseEventHandler, useContext, useEffect, useRef, useState } from "react"; import { sendAll } from "../../controllers/NodesServices"; import { alertContext } from "../../contexts/alertContext"; import { classNames, nodeColors } from "../../utils"; @@ -89,7 +89,7 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { sendAll({ ...reactFlowInstance.toObject(), message, chatHistory }) .then((r) => { console.log(r.data); - addChatHistory(r.data.result, false,r.data.thought); + addChatHistory(r.data.result, false, r.data.thought); setLockChat(false); }) .catch((error) => { @@ -109,6 +109,10 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { }); } } + function clearChat() { + setChatHistory([]) + updateFlow({ ..._.cloneDeep(flow), chat: []}); + } return ( <> @@ -137,10 +141,18 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { /> Chat
+
{chatHistory.map((c, i) => ( - + ))}
@@ -154,7 +166,7 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { }} type="text" disabled={lockChat} - value={lockChat?"Thinking...": chatValue} + value={lockChat ? "Thinking..." : chatValue} onChange={(e) => { setChatValue(e.target.value); }} diff --git a/langflow/frontend/src/components/inputComponent/index.tsx b/langflow/frontend/src/components/inputComponent/index.tsx index d81795907..bb1a5ed43 100644 --- a/langflow/frontend/src/components/inputComponent/index.tsx +++ b/langflow/frontend/src/components/inputComponent/index.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from "react"; import { InputComponentType } from "../../types/components"; -export default function InputComponent({value, onChange, disabled}: InputComponentType){ +export default function InputComponent({value, onChange, disabled, password}: InputComponentType){ const [myValue, setMyValue] = useState(value ?? ""); useEffect(()=> { if(disabled){ @@ -12,7 +12,7 @@ export default function InputComponent({value, onChange, disabled}: InputCompone return (
n.id !== idx) ); + reactFlowInstance.setEdges(reactFlowInstance.getEdges().filter((ns) => ns.source !== idx && ns.target !== idx)); } return ( { + setEdges(edges.filter((ns) => !nodes.some((n) => ns.source === n.id || ns.target === n.id))); + } return (
@@ -174,6 +178,7 @@ export default function FlowPage({ flow }:{flow:FlowType}) { connectionLineComponent={ConnectionLineComponent} onDragOver={onDragOver} onDrop={onDrop} + onNodesDelete={onDelete} > diff --git a/langflow/frontend/src/types/components/index.ts b/langflow/frontend/src/types/components/index.ts index 5f02e9c5e..c0ce80f09 100644 --- a/langflow/frontend/src/types/components/index.ts +++ b/langflow/frontend/src/types/components/index.ts @@ -4,6 +4,7 @@ export type InputComponentType = { value: string; disabled?: boolean; onChange: (value: string) => void; + password: boolean; }; export type ToggleComponentType = { enabled: boolean; diff --git a/langflow/frontend/src/utils.ts b/langflow/frontend/src/utils.ts index 82e09e979..c95f17834 100644 --- a/langflow/frontend/src/utils.ts +++ b/langflow/frontend/src/utils.ts @@ -286,6 +286,18 @@ export function snakeToNormalCase(str: string) { .join(" "); } +export function normalCaseToSnakeCase(str:string){ + return str + .split(" ") + .map((word, index) => { + if (index === 0) { + return word[0].toUpperCase() + word.slice(1).toLowerCase(); + } + return word.toLowerCase(); + }) + .join("_"); +} + export function roundNumber(x:number, decimals:number) { return Math.round(x * Math.pow(10, decimals)) / Math.pow(10, decimals); } @@ -303,7 +315,6 @@ export function isValidConnection( { source, target, sourceHandle, targetHandle }:Connection, reactFlowInstance:ReactFlowInstance ) { - console.log(target) if ( sourceHandle.split('|')[0] === targetHandle.split("|")[0] || sourceHandle.split('|').slice(2).some((t) => t === targetHandle.split("|")[0]) ||