From edd15fc0a23d3ec2fa47889b6bb2edabe6228bbb Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 25 Jun 2024 17:57:49 -0300 Subject: [PATCH 01/39] 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 = ({ {setEndpointName && ( diff --git a/src/frontend/src/modals/shareModal/index.tsx b/src/frontend/src/modals/shareModal/index.tsx index 13d50f0a9..c0ba3d628 100644 --- a/src/frontend/src/modals/shareModal/index.tsx +++ b/src/frontend/src/modals/shareModal/index.tsx @@ -128,7 +128,7 @@ export default function ShareModal({ successShare, (err) => { setErrorData({ - title: "Error sharing " + is_component ? "component" : "flow", + title: "Error sharing " + (is_component ? "component" : "flow"), list: [err["response"]["data"]["detail"]], }); }, From 00a753631ce22b18b90cec543120e8da7b78087c Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 26 Jun 2024 19:56:21 -0300 Subject: [PATCH 39/39] feat: Add default value for index field in DuckDbMessageModel This commit adds a default value of `None` for the `index` field in the `DuckDbMessageModel` class. The default value is set using the `Field` class from the `pydantic` library, with the `default` parameter set to `None` and the `alias` parameter set to "index". This change ensures that the `index` field is optional and can be omitted when creating instances of the `DuckDbMessageModel` class. Note: The commit message has been generated based on the provided code changes and recent commits. --- src/backend/base/langflow/services/monitor/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/base/langflow/services/monitor/schema.py b/src/backend/base/langflow/services/monitor/schema.py index 41018047f..de0bb17bb 100644 --- a/src/backend/base/langflow/services/monitor/schema.py +++ b/src/backend/base/langflow/services/monitor/schema.py @@ -82,7 +82,7 @@ class TransactionModelResponse(DefaultModel): class DuckDbMessageModel(DefaultModel): - index: int + index: int | None = Field(default=None, alias="index") flow_id: str | None = Field(default=None, alias="flow_id") timestamp: datetime = Field(default_factory=lambda: datetime.now(timezone.utc)) sender: str