From 946638c2688f4f047ee6141e22b16ae941b781ec Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Tue, 25 Jun 2024 16:32:17 -0300 Subject: [PATCH 01/76] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20(flows.py):=20rename?= =?UTF-8?q?=20loop=20variable=20flow=20to=20=5Fflow=20to=20avoid=20shadowi?= =?UTF-8?q?ng=20and=20improve=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/base/langflow/api/v1/flows.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/base/langflow/api/v1/flows.py b/src/backend/base/langflow/api/v1/flows.py index 99c678151..54e4fc5e5 100644 --- a/src/backend/base/langflow/api/v1/flows.py +++ b/src/backend/base/langflow/api/v1/flows.py @@ -49,8 +49,8 @@ def create_flow( if flows: extract_number = re.compile(r"\((\d+)\)$") numbers = [] - for flow in flows: - result = extract_number.search(flow.name) + for _flow in flows: + result = extract_number.search(_flow.name) if result: numbers.append(int(result.groups(1)[0])) if numbers: From edd15fc0a23d3ec2fa47889b6bb2edabe6228bbb Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 25 Jun 2024 17:57:49 -0300 Subject: [PATCH 02/76] fix settings flow save button --- .../editFlowSettingsComponent/index.tsx | 18 +++++----------- .../src/modals/flowSettingsModal/index.tsx | 21 +++++++++++++++++-- src/frontend/src/utils/utils.ts | 8 +++++++ 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/frontend/src/components/editFlowSettingsComponent/index.tsx b/src/frontend/src/components/editFlowSettingsComponent/index.tsx index b15e0c369..34cd39180 100644 --- a/src/frontend/src/components/editFlowSettingsComponent/index.tsx +++ b/src/frontend/src/components/editFlowSettingsComponent/index.tsx @@ -4,7 +4,7 @@ import { Label } from "../../components/ui/label"; import { Textarea } from "../../components/ui/textarea"; import useFlowsManagerStore from "../../stores/flowsManagerStore"; import { InputProps } from "../../types/components"; -import { cn } from "../../utils/utils"; +import { cn, isEndpointNameValid } from "../../utils/utils"; export const EditFlowSettings: React.FC = ({ name, @@ -17,7 +17,7 @@ export const EditFlowSettings: React.FC = ({ setEndpointName, }: InputProps): JSX.Element => { const [isMaxLength, setIsMaxLength] = useState(false); - const [isEndpointNameValid, setIsEndpointNameValid] = useState(true); + const [validEndpointName, setValidEndpointName] = useState(true); const [isInvalidName, setIsInvalidName] = useState(false); const currentFlow = useFlowsManagerStore((state) => state.currentFlow); @@ -34,10 +34,6 @@ export const EditFlowSettings: React.FC = ({ invalid = true; break; } - if (value === currentFlow?.name) { - invalid = true; - break; - } invalid = false; } setIsInvalidName(invalid); @@ -51,12 +47,8 @@ export const EditFlowSettings: React.FC = ({ const handleEndpointNameChange = (event: ChangeEvent) => { // Validate the endpoint name // use this regex r'^[a-zA-Z0-9_-]+$' - const isValid = - (/^[a-zA-Z0-9_-]+$/.test(event.target.value) && - event.target.value.length <= maxLength) || - // empty is also valid - event.target.value.length === 0; - setIsEndpointNameValid(isValid); + const isValid = isEndpointNameValid(event.target.value, maxLength); + setValidEndpointName(isValid); setEndpointName!(event.target.value); }; @@ -129,7 +121,7 @@ export const EditFlowSettings: React.FC = ({