From 97ac3f098adfbff55456290f01bd40809e2b5c54 Mon Sep 17 00:00:00 2001 From: Vigtu Date: Mon, 23 Dec 2024 16:33:19 -0300 Subject: [PATCH 1/2] feat(conditional-router): rename 'matches regex' to 'regex' - Simplify the operator name in the ConditionalRouter component - Update dropdown options for better UX - Maintain existing functionality while using more concise naming --- .../base/langflow/components/logic/conditional_router.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/base/langflow/components/logic/conditional_router.py b/src/backend/base/langflow/components/logic/conditional_router.py index 80c2739a6b52..f8c741442aac 100644 --- a/src/backend/base/langflow/components/logic/conditional_router.py +++ b/src/backend/base/langflow/components/logic/conditional_router.py @@ -29,7 +29,7 @@ def __init__(self, *args, **kwargs): DropdownInput( name="operator", display_name="Operator", - options=["equals", "not equals", "contains", "starts with", "ends with", "matches regex"], + options=["equals", "not equals", "contains", "starts with", "ends with", "regex"], info="The operator to apply for comparing the texts.", value="equals", real_time_refresh=True, @@ -72,7 +72,7 @@ def _pre_run_setup(self): self.__iteration_updated = False def evaluate_condition(self, input_text: str, match_text: str, operator: str, *, case_sensitive: bool) -> bool: - if not case_sensitive and operator != "matches regex": + if not case_sensitive and operator != "regex": input_text = input_text.lower() match_text = match_text.lower() @@ -86,7 +86,7 @@ def evaluate_condition(self, input_text: str, match_text: str, operator: str, *, return input_text.startswith(match_text) if operator == "ends with": return input_text.endswith(match_text) - if operator == "matches regex": + if operator == "regex": try: return bool(re.match(match_text, input_text)) except re.error: @@ -125,7 +125,7 @@ def false_response(self) -> Message: def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None) -> dict: if field_name == "operator": - if field_value == "matches regex": + if field_value == "regex": if "case_sensitive" in build_config: del build_config["case_sensitive"] # Ensure case_sensitive is present for all other operators From e6dc506d5ba0b2e3fa0cdc50715584ec5cc87a13 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2024 11:54:58 +0000 Subject: [PATCH 2/2] [autofix.ci] apply automated fixes --- src/backend/base/langflow/components/logic/conditional_router.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/backend/base/langflow/components/logic/conditional_router.py b/src/backend/base/langflow/components/logic/conditional_router.py index ce4459b3c9a0..0e6d419e1adc 100644 --- a/src/backend/base/langflow/components/logic/conditional_router.py +++ b/src/backend/base/langflow/components/logic/conditional_router.py @@ -125,7 +125,6 @@ def false_response(self) -> Message: def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None) -> dict: if field_name == "operator": - if field_value == "regex": build_config.pop("case_sensitive", None)