From ff227126864d04d78c6405ebdb4e226af47dbaa0 Mon Sep 17 00:00:00 2001 From: "sp.wack" <83104063+amanape@users.noreply.github.com> Date: Sat, 24 May 2025 22:20:08 +0400 Subject: [PATCH] fix(frontend): Use uppercase event type for generic events without translation keys (#8671) Co-authored-by: openhands --- .../get-event-content.tsx | 79 +++++++++++-------- 1 file changed, 48 insertions(+), 31 deletions(-) diff --git a/frontend/src/components/features/chat/event-content-helpers/get-event-content.tsx b/frontend/src/components/features/chat/event-content-helpers/get-event-content.tsx index 4f9da58295..ee75007a05 100644 --- a/frontend/src/components/features/chat/event-content-helpers/get-event-content.tsx +++ b/frontend/src/components/features/chat/event-content-helpers/get-event-content.tsx @@ -28,41 +28,58 @@ export const getEventContent = ( let details: string = ""; if (isOpenHandsAction(event)) { - title = ( - , - cmd: , - }} - /> - ); + const actionKey = `ACTION_MESSAGE$${event.action.toUpperCase()}`; + + // If translation key exists, use Trans component + if (i18n.exists(actionKey)) { + title = ( + , + cmd: , + }} + /> + ); + } else { + // For generic actions, just use the uppercase type + title = event.action.toUpperCase(); + } details = getActionContent(event); } if (isOpenHandsObservation(event)) { - title = ( - , - cmd: , - }} - /> - ); + const observationKey = `OBSERVATION_MESSAGE$${event.observation.toUpperCase()}`; + + // If translation key exists, use Trans component + if (i18n.exists(observationKey)) { + title = ( + , + cmd: , + }} + /> + ); + } else { + // For generic observations, just use the uppercase type + title = event.observation.toUpperCase(); + } details = getObservationContent(event); }