@@ -35,6 +35,7 @@ import ToolResponse, { ToolResponseProps } from '../ToolResponse';
3535import DeepThinking , { DeepThinkingProps } from '../DeepThinking' ;
3636import ToolCall , { ToolCallProps } from '../ToolCall' ;
3737import MarkdownContent from '../MarkdownContent' ;
38+ import { css } from '@patternfly/react-styles' ;
3839
3940export interface MessageAttachment {
4041 /** Name of file attached to the message */
@@ -73,6 +74,10 @@ export interface MessageProps extends Omit<HTMLProps<HTMLDivElement>, 'role'> {
7374 id ?: string ;
7475 /** Role of the user sending the message */
7576 role : 'user' | 'bot' ;
77+ /** Whether the message is aligned at the horizontal start or end of the message container. */
78+ alignment ?: 'start' | 'end' ;
79+ /** Flag indicating whether message metadata (user name and timestamp) are visible. */
80+ isMetadataVisible ?: boolean ;
7681 /** Message content */
7782 content ?: string ;
7883 /** Extra Message content */
@@ -197,6 +202,8 @@ export interface MessageProps extends Omit<HTMLProps<HTMLDivElement>, 'role'> {
197202export const MessageBase : FunctionComponent < MessageProps > = ( {
198203 children,
199204 role,
205+ alignment = 'start' ,
206+ isMetadataVisible = true ,
200207 content,
201208 extraContent,
202209 name,
@@ -314,7 +321,7 @@ export const MessageBase: FunctionComponent<MessageProps> = ({
314321 return (
315322 < section
316323 aria-label = { `Message from ${ role } - ${ dateString } ` }
317- className = { `pf-chatbot__message pf-chatbot__message--${ role } ` }
324+ className = { css ( `pf-chatbot__message pf-chatbot__message--${ role } ` , alignment === 'end' && 'pf-m-end' ) }
318325 aria-live = { isLiveRegion ? 'polite' : undefined }
319326 aria-atomic = { isLiveRegion ? false : undefined }
320327 ref = { innerRef }
@@ -330,19 +337,21 @@ export const MessageBase: FunctionComponent<MessageProps> = ({
330337 />
331338 ) }
332339 < div className = "pf-chatbot__message-contents" >
333- < div className = "pf-chatbot__message-meta" >
334- { name && (
335- < span className = "pf-chatbot__message-name" >
336- < Truncate content = { name } />
337- </ span >
338- ) }
339- { role === 'bot' && (
340- < Label variant = "outline" isCompact >
341- { botWord }
342- </ Label >
343- ) }
344- < Timestamp date = { date } > { timestamp } </ Timestamp >
345- </ div >
340+ { isMetadataVisible && (
341+ < div className = "pf-chatbot__message-meta" >
342+ { name && (
343+ < span className = "pf-chatbot__message-name" >
344+ < Truncate content = { name } />
345+ </ span >
346+ ) }
347+ { role === 'bot' && (
348+ < Label variant = "outline" isCompact >
349+ { botWord }
350+ </ Label >
351+ ) }
352+ < Timestamp date = { date } > { timestamp } </ Timestamp >
353+ </ div >
354+ ) }
346355 < div className = "pf-chatbot__message-response" >
347356 { children ? (
348357 < > { children } </ >
0 commit comments