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 <ericrhare@gmail.com>
This commit is contained in:
parent
a23c566269
commit
892ffe6bd9
1 changed files with 8 additions and 1 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue