Skip to content

Commit 9d64d08

Browse files
Vigtuogabrielluizautofix-ci[bot]
authored
feat(conditional-router): rename 'matches regex' to 'regex' (#5410)
* 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 * [autofix.ci] apply automated fixes --------- Co-authored-by: Gabriel Luiz Freitas Almeida <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 9ee6310 commit 9d64d08

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/backend/base/langflow/components/logic/conditional_router.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(self, *args, **kwargs):
2929
DropdownInput(
3030
name="operator",
3131
display_name="Operator",
32-
options=["equals", "not equals", "contains", "starts with", "ends with", "matches regex"],
32+
options=["equals", "not equals", "contains", "starts with", "ends with", "regex"],
3333
info="The operator to apply for comparing the texts.",
3434
value="equals",
3535
real_time_refresh=True,
@@ -72,7 +72,7 @@ def _pre_run_setup(self):
7272
self.__iteration_updated = False
7373

7474
def evaluate_condition(self, input_text: str, match_text: str, operator: str, *, case_sensitive: bool) -> bool:
75-
if not case_sensitive and operator != "matches regex":
75+
if not case_sensitive and operator != "regex":
7676
input_text = input_text.lower()
7777
match_text = match_text.lower()
7878

@@ -86,7 +86,7 @@ def evaluate_condition(self, input_text: str, match_text: str, operator: str, *,
8686
return input_text.startswith(match_text)
8787
if operator == "ends with":
8888
return input_text.endswith(match_text)
89-
if operator == "matches regex":
89+
if operator == "regex":
9090
try:
9191
return bool(re.match(match_text, input_text))
9292
except re.error:
@@ -125,8 +125,9 @@ def false_response(self) -> Message:
125125

126126
def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None) -> dict:
127127
if field_name == "operator":
128-
if field_value == "matches regex":
128+
if field_value == "regex":
129129
build_config.pop("case_sensitive", None)
130+
130131
# Ensure case_sensitive is present for all other operators
131132
elif "case_sensitive" not in build_config:
132133
case_sensitive_input = next(

0 commit comments

Comments
 (0)