@@ -41,6 +41,7 @@ import ConfirmDialog from '@/ui-component/dialog/ConfirmDialog'
41
41
import PromptGeneratorDialog from '@/ui-component/dialog/PromptGeneratorDialog'
42
42
import { Available } from '@/ui-component/rbac/available'
43
43
import ExpandTextDialog from '@/ui-component/dialog/ExpandTextDialog'
44
+ import { SwitchInput } from '@/ui-component/switch/Switch'
44
45
45
46
// API
46
47
import assistantsApi from '@/api/assistants'
@@ -351,6 +352,7 @@ const CustomAssistantConfigurePreview = () => {
351
352
const retrieverToolNodeData = cloneDeep ( initNode ( retrieverToolNode . data , retrieverToolId ) )
352
353
353
354
set ( docStoreVSNodeData , 'inputs.selectedStore' , selectedDocumentStores [ i ] . id )
355
+ set ( docStoreVSNodeData , 'outputs.output' , 'retriever' )
354
356
355
357
const docStoreOption = documentStoreOptions . find ( ( ds ) => ds . name === selectedDocumentStores [ i ] . id )
356
358
// convert to small case and replace space with underscore
@@ -364,7 +366,7 @@ const CustomAssistantConfigurePreview = () => {
364
366
name,
365
367
description : desc ,
366
368
retriever : `{{${ docStoreVSId } .data.instance}}` ,
367
- returnSourceDocuments : true
369
+ returnSourceDocuments : selectedDocumentStores [ i ] . returnSourceDocuments ?? false
368
370
} )
369
371
370
372
const docStoreVS = {
@@ -671,7 +673,8 @@ const CustomAssistantConfigurePreview = () => {
671
673
const newDocStore = {
672
674
id : docStoreId ,
673
675
name : foundDocumentStoreOption ?. label || '' ,
674
- description : foundSelectedDocumentStore ?. description || foundDocumentStoreOption ?. description || ''
676
+ description : foundSelectedDocumentStore ?. description || foundDocumentStoreOption ?. description || '' ,
677
+ returnSourceDocuments : foundSelectedDocumentStore ?. returnSourceDocuments ?? false
675
678
}
676
679
677
680
newSelectedDocumentStores . push ( newDocStore )
@@ -1133,6 +1136,18 @@ const CustomAssistantConfigurePreview = () => {
1133
1136
setSelectedDocumentStores ( newSelectedDocumentStores )
1134
1137
} }
1135
1138
/>
1139
+ < Stack sx = { { mt : 2 , position : 'relative' , alignItems : 'center' } } direction = 'row' >
1140
+ < Typography > Return Source Documents</ Typography >
1141
+ < TooltipWithParser title = 'Return the actual source documents that were used to answer the question' />
1142
+ </ Stack >
1143
+ < SwitchInput
1144
+ value = { ds . returnSourceDocuments ?? false }
1145
+ onChange = { ( newValue ) => {
1146
+ const newSelectedDocumentStores = [ ...selectedDocumentStores ]
1147
+ newSelectedDocumentStores [ index ] . returnSourceDocuments = newValue
1148
+ setSelectedDocumentStores ( newSelectedDocumentStores )
1149
+ } }
1150
+ />
1136
1151
</ Box >
1137
1152
)
1138
1153
} ) }
0 commit comments