File tree Expand file tree Collapse file tree 5 files changed +10
-8
lines changed
Expand file tree Collapse file tree 5 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ export const Chat = <
5555 defaultLanguage,
5656 i18nInstance,
5757 initialNavOpen = true ,
58- isMessageAIGenerated = ( ) => false ,
58+ isMessageAIGenerated,
5959 theme = 'messaging light' ,
6060 useImageFlagEmojisOnWindows = false ,
6161 } = props ;
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ export const useCreateChatContext = <
6060 getAppSettings ,
6161 mutedUsersLength ,
6262 navOpen ,
63+ isMessageAIGenerated ,
6364 ] ,
6465 ) ;
6566
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ const MessageSimpleWithContext = <
102102 const showReplyCountButton = ! threadList && ! ! message . reply_count ;
103103 const allowRetry = message . status === 'failed' && message . errorStatusCode !== 403 ;
104104 const isBounced = isMessageBounced ( message ) ;
105- const isEdited = isMessageEdited ( message ) && ! isMessageAIGenerated ( message ) ;
105+ const isEdited = isMessageEdited ( message ) && ! isMessageAIGenerated ?. ( message ) ;
106106
107107 let handleClick : ( ( ) => void ) | undefined = undefined ;
108108
@@ -188,7 +188,7 @@ const MessageSimpleWithContext = <
188188 { message . attachments ?. length && ! message . quoted_message ? (
189189 < Attachment actionHandler = { handleAction } attachments = { message . attachments } />
190190 ) : null }
191- { isMessageAIGenerated ( message ) ? (
191+ { isMessageAIGenerated ?. ( message ) ? (
192192 < StreamedMessageText message = { message } renderText = { renderText } />
193193 ) : (
194194 < MessageText message = { message } renderText = { renderText } />
Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ export type ChatContextValue<
5656 */
5757 customClasses ?: CustomClasses ;
5858 navOpen ?: boolean ;
59- } & Required < Pick < ChatProps < StreamChatGenerics > , 'theme' | 'client' | 'isMessageAIGenerated' > > ;
59+ } & Partial < Pick < ChatProps < StreamChatGenerics > , 'isMessageAIGenerated' > > &
60+ Required < Pick < ChatProps < StreamChatGenerics > , 'theme' | 'client' > > ;
6061
6162export const ChatContext = React . createContext < ChatContextValue | undefined > ( undefined ) ;
6263
Original file line number Diff line number Diff line change @@ -68,10 +68,6 @@ export type MessageContextValue<
6868 handleReaction : ( reactionType : string , event : React . BaseSyntheticEvent ) => Promise < void > ;
6969 /** Function to retry sending a Message */
7070 handleRetry : ChannelActionContextValue < StreamChatGenerics > [ 'retrySendMessage' ] ;
71- /**
72- * A factory function that determines whether a message is AI generated or not.
73- */
74- isMessageAIGenerated : ( message : StreamMessage < StreamChatGenerics > ) => boolean ;
7571 /** Function that returns whether the Message belongs to the current user */
7672 isMyMessage : ( ) => boolean ;
7773 /** The message object */
@@ -110,6 +106,10 @@ export type MessageContextValue<
110106 highlighted ?: boolean ;
111107 /** Whether the threaded message is the first in the thread list */
112108 initialMessage ?: boolean ;
109+ /**
110+ * A factory function that determines whether a message is AI generated or not.
111+ */
112+ isMessageAIGenerated ?: ( message : StreamMessage < StreamChatGenerics > ) => boolean ;
113113 /** Latest message id on current channel */
114114 lastReceivedId ?: string | null ;
115115 /** DOMRect object for parent MessageList component */
You can’t perform that action at this time.
0 commit comments