π OpenHands: AI-Driven Development
fix(frontend): Use uppercase event type for generic events without translation keys (#8671)
sp.wackff227126864d
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.tsxindex 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 = (- <Trans- i18nKey={`ACTION_MESSAGE$${event.action.toUpperCase()}`}- values={{- path: hasPathProperty(event.args) && event.args.path,- command:- hasCommandProperty(event.args) && trimText(event.args.command, 80),- mcp_tool_name: event.action === "call_tool_mcp" && event.args.name,- }}- components={{- path: <PathComponent />,- cmd: <MonoComponent />,- }}- />- );+ const actionKey = `ACTION_MESSAGE$${event.action.toUpperCase()}`;++ // If translation key exists, use Trans component+ if (i18n.exists(actionKey)) {+ title = (+ <Trans+ i18nKey={actionKey}+ values={{+ path: hasPathProperty(event.args) && event.args.path,+ command:+ hasCommandProperty(event.args) &&+ trimText(event.args.command, 80),+ mcp_tool_name: event.action === "call_tool_mcp" && event.args.name,+ }}+ components={{+ path: <PathComponent />,+ cmd: <MonoComponent />,+ }}+ />+ );+ } else {+ // For generic actions, just use the uppercase type+ title = event.action.toUpperCase();+ }details = getActionContent(event);}if (isOpenHandsObservation(event)) {- title = (- <Trans- i18nKey={`OBSERVATION_MESSAGE$${event.observation.toUpperCase()}`}- values={{- path: hasPathProperty(event.extras) && event.extras.path,- command:- hasCommandProperty(event.extras) &&- trimText(event.extras.command, 80),- mcp_tool_name: event.observation === "mcp" && event.extras.name,- }}- components={{- path: <PathComponent />,- cmd: <MonoComponent />,- }}- />- );+ const observationKey = `OBSERVATION_MESSAGE$${event.observation.toUpperCase()}`;++ // If translation key exists, use Trans component+ if (i18n.exists(observationKey)) {+ title = (+ <Trans+ i18nKey={observationKey}+ values={{+ path: hasPathProperty(event.extras) && event.extras.path,+ command:+ hasCommandProperty(event.extras) &&+ trimText(event.extras.command, 80),+ mcp_tool_name: event.observation === "mcp" && event.extras.name,+ }}+ components={{+ path: <PathComponent />,+ cmd: <MonoComponent />,+ }}+ />+ );+ } else {+ // For generic observations, just use the uppercase type+ title = event.observation.toUpperCase();+ }details = getObservationContent(event);}