From 892ffe6bd9aa4c1e98c44fec9886a7601eddab37 Mon Sep 17 00:00:00 2001 From: Edwin Jose Date: Thu, 12 Jun 2025 12:47:18 -0500 Subject: [PATCH] fix(input): refine input handling and improve event robustness (#8472) * Update model_input_constants.py * Update component.py * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Eric Hare --- .../base/langflow/custom/custom_component/component.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/backend/base/langflow/custom/custom_component/component.py b/src/backend/base/langflow/custom/custom_component/component.py index 122d962dc..7cc440d5b 100644 --- a/src/backend/base/langflow/custom/custom_component/component.py +++ b/src/backend/base/langflow/custom/custom_component/component.py @@ -1399,7 +1399,14 @@ class Component(CustomComponent): case "error": self._event_manager.on_error(data=data_dict) case "remove_message": - self._event_manager.on_remove_message(data={"id": data_dict["id"]}) + # Check if id exists in data_dict before accessing it + if "id" in data_dict: + self._event_manager.on_remove_message(data={"id": data_dict["id"]}) + else: + # If no id, try to get it from the message object or id_ parameter + message_id = getattr(message, "id", None) or id_ + if message_id: + self._event_manager.on_remove_message(data={"id": message_id}) case _: self._event_manager.on_message(data=data_dict)