-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional Router
does not stop correctly
#4490
Comments
The issue with the Here's the relevant part of the code: def iterate_and_stop_once(self, route_to_stop: str):
if not self.__iteration_updated:
self.update_ctx({f"{self._id}_iteration": self.ctx.get(f"{self._id}_iteration", 0) + 1})
self.__iteration_updated = True
if self.ctx.get(f"{self._id}_iteration", 0) >= self.max_iterations and route_to_stop == self.default_route:
# We need to stop the other route
route_to_stop = "true_result" if route_to_stop == "false_result" else "false_result"
self.stop(route_to_stop) The problem arises because the To fix this, the def iterate_and_stop_once(self, route_to_stop: str):
if not self.__iteration_updated:
self.update_ctx({f"{self._id}_iteration": self.ctx.get(f"{self._id}_iteration", 0) + 1})
self.__iteration_updated = True
if self.ctx.get(f"{self._id}_iteration", 0) >= self.max_iterations and route_to_stop == self.default_route:
# We need to stop the other route
route_to_stop = "true_result" if route_to_stop == "false_result" else "false_result"
self.stop(route_to_stop) # Ensure this uses the updated route_to_stop This change ensures that the correct route is stopped, preventing the message from being processed twice and avoiding the "Error parsing message" [1]. |
Hi, I have the same question. I change the conditional Router with
With the workflow: [python 3.12.3, langflow 1.0.17]20241114_debug_conditional_router.json Test Case1.input=A, expected_output=A, real_output=A None None 2.input=B, expected_output=B, real_output=None B None
[python 3.12.3, langflow 1.1.0]Still not work in this version: |
@joaoguilhermeS - I have given the details. |
Bug Description
Conditional Router
does not stop correctly. The input message display twice, followed by a error message: "Error parsing message".It's not reproduced every time, try more times.
Reproduction
hello
in the playgroundExpected behavior
return
hi, there I'm a robot
directly and no error messageWho can help?
No response
Operating System
manjaro
Langflow Version
v1.0.19.post2
Python Version
None
Screenshot
Flow File
Simple Conditional Router.json
The text was updated successfully, but these errors were encountered: