11import { Fragment , ReactElement , useMemo } from 'react' ;
2+ import { FollowUpsList } from '@open-webui-react-native/mobile/chat/features/follow-ups-list' ;
23import { MessageVersionControls } from '@open-webui-react-native/mobile/chat/features/message-version-controls' ;
34import { SourceCitationModal } from '@open-webui-react-native/mobile/chat/features/source-citation-modal' ;
45import { prepareTextWithCitations , useCitations } from '@open-webui-react-native/mobile/chat/features/use-citations' ;
@@ -22,6 +23,9 @@ import { SkeletonMessage } from '../skeleton-message';
2223interface ChatAiMessageProps {
2324 message : Message ;
2425 onEditPress : ( ) => void ;
26+ isLast : boolean ;
27+ isResponseGenerating : boolean ;
28+ onFollowUpPress : ( text : string ) => void ;
2529 isEditing ?: boolean ;
2630 onPreviousSibling ?: UseSiblingMessagesReturn [ 'showPreviousSibling' ] ;
2731 onNextSibling ?: UseSiblingMessagesReturn [ 'showNextSibling' ] ;
@@ -34,6 +38,9 @@ export function ChatAiMessage({
3438 onNextSibling,
3539 onPreviousSibling,
3640 getSiblingsInfo,
41+ isLast,
42+ isResponseGenerating,
43+ onFollowUpPress,
3744} : ChatAiMessageProps ) : ReactElement {
3845 const {
3946 content : text ,
@@ -43,6 +50,7 @@ export function ChatAiMessage({
4350 done : isMessageDone ,
4451 socketStatusData,
4552 timestamp,
53+ followUps,
4654 } = message ;
4755
4856 const apiUrl = getApiUrl ( ) ;
@@ -64,6 +72,7 @@ export function ChatAiMessage({
6472 useImagePreview ( ) ;
6573
6674 const textWithCitations = prepareTextWithCitations ( text , citations ) ;
75+ const hasFollowUps = Array . isArray ( followUps ) && followUps . length > 0 ;
6776
6877 return (
6978 < View >
@@ -119,6 +128,12 @@ export function ChatAiMessage({
119128 ) : (
120129 < SkeletonMessage />
121130 ) }
131+ { ! isResponseGenerating && isLast && hasFollowUps && (
132+ < FollowUpsList
133+ followUps = { followUps }
134+ onPress = { onFollowUpPress }
135+ containerClassName = 'mt-12' />
136+ ) }
122137 </ View >
123138 ) ;
124139}
0 commit comments