@@ -52,22 +52,26 @@ export const ChatConversation = memo(function ChatConversation({ chatId, getConf
5252
5353 const toast = useToast ( ) ;
5454
55- const { isLoading : isLoadingMessages } = useSWR < ChatItem > ( chatId ? API_ROUTES . GET_CHAT ( chatId ) : null , get , {
56- onSuccess ( data ) {
57- setMessages ( data . messages . sort ( ( a , b ) => Date . parse ( a . created_at ) - Date . parse ( b . created_at ) ) ) ;
58- setActiveThreadTailMessageId ( data . active_thread_tail_message_id ) ;
59- } ,
60- onError : ( err ) => {
61- if ( err instanceof OasstError && err . httpStatusCode === 404 ) {
62- // chat does not exist, probably deleted
63- return router . push ( "/chat" ) ;
64- }
65- toast ( {
66- title : "Failed to load chat" ,
67- status : "error" ,
68- } ) ;
69- } ,
70- } ) ;
55+ const { isLoading : isLoadingMessages , data : chatData } = useSWR < ChatItem > (
56+ chatId ? API_ROUTES . GET_CHAT ( chatId ) : null ,
57+ get ,
58+ {
59+ onSuccess ( data ) {
60+ setMessages ( data . messages . sort ( ( a , b ) => Date . parse ( a . created_at ) - Date . parse ( b . created_at ) ) ) ;
61+ setActiveThreadTailMessageId ( data . active_thread_tail_message_id ) ;
62+ } ,
63+ onError : ( err ) => {
64+ if ( err instanceof OasstError && err . httpStatusCode === 404 ) {
65+ // chat does not exist, probably deleted
66+ return router . push ( "/chat" ) ;
67+ }
68+ toast ( {
69+ title : "Failed to load chat" ,
70+ status : "error" ,
71+ } ) ;
72+ } ,
73+ }
74+ ) ;
7175
7276 const createAndFetchAssistantMessage = useCallback (
7377 async ( { parentId, chatId } : { parentId : string ; chatId : string } ) => {
@@ -306,7 +310,11 @@ export const ChatConversation = memo(function ChatConversation({ chatId, getConf
306310 setReytryingParentId ( params . parentId ) ;
307311
308312 const { plugins } = getConfigValues ( ) ;
309- if ( ( ! ENABLE_DRAFTS_WITH_PLUGINS && plugins . length !== 0 ) || NUM_GENERATED_DRAFTS <= 1 ) {
313+ if (
314+ ( ! ENABLE_DRAFTS_WITH_PLUGINS && plugins . length !== 0 ) ||
315+ NUM_GENERATED_DRAFTS <= 1 ||
316+ ! chatData . allow_data_use
317+ ) {
310318 await createAndFetchAssistantMessage ( params ) ;
311319 setReytryingParentId ( null ) ;
312320 } else {
@@ -320,6 +328,7 @@ export const ChatConversation = memo(function ChatConversation({ chatId, getConf
320328 ENABLE_DRAFTS_WITH_PLUGINS ,
321329 NUM_GENERATED_DRAFTS ,
322330 createAndFetchAssistantMessage ,
331+ chatData ?. allow_data_use ,
323332 ]
324333 ) ;
325334 const handleOnVote : ChatMessageEntryProps [ "onVote" ] = useCallback (
@@ -470,6 +479,7 @@ export const ChatConversation = memo(function ChatConversation({ chatId, getConf
470479 onEditPrompt = { handleEditPrompt }
471480 showEncourageMessage = { showEncourageMessage }
472481 onEncourageMessageClose = { setShowEncourageMessage . off }
482+ showFeedbackOptions = { chatData ?. allow_data_use }
473483 > </ ChatConversationTree >
474484 { isSending && streamedResponse && < PendingMessageEntry isAssistant content = { streamedResponse } /> }
475485 { ( isSending || isAwaitingMessageSelect ) &&
0 commit comments