@@ -52,22 +52,26 @@ export const ChatConversation = memo(function ChatConversation({ chatId, getConf
52
52
53
53
const toast = useToast ( ) ;
54
54
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
+ ) ;
71
75
72
76
const createAndFetchAssistantMessage = useCallback (
73
77
async ( { parentId, chatId } : { parentId : string ; chatId : string } ) => {
@@ -306,7 +310,11 @@ export const ChatConversation = memo(function ChatConversation({ chatId, getConf
306
310
setReytryingParentId ( params . parentId ) ;
307
311
308
312
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
+ ) {
310
318
await createAndFetchAssistantMessage ( params ) ;
311
319
setReytryingParentId ( null ) ;
312
320
} else {
@@ -320,6 +328,7 @@ export const ChatConversation = memo(function ChatConversation({ chatId, getConf
320
328
ENABLE_DRAFTS_WITH_PLUGINS ,
321
329
NUM_GENERATED_DRAFTS ,
322
330
createAndFetchAssistantMessage ,
331
+ chatData ?. allow_data_use ,
323
332
]
324
333
) ;
325
334
const handleOnVote : ChatMessageEntryProps [ "onVote" ] = useCallback (
@@ -470,6 +479,7 @@ export const ChatConversation = memo(function ChatConversation({ chatId, getConf
470
479
onEditPrompt = { handleEditPrompt }
471
480
showEncourageMessage = { showEncourageMessage }
472
481
onEncourageMessageClose = { setShowEncourageMessage . off }
482
+ showFeedbackOptions = { chatData ?. allow_data_use }
473
483
> </ ChatConversationTree >
474
484
{ isSending && streamedResponse && < PendingMessageEntry isAssistant content = { streamedResponse } /> }
475
485
{ ( isSending || isAwaitingMessageSelect ) &&
0 commit comments