Skip to content

Commit 496ab93

Browse files
ritvikPuranikHenryHengZJ
authored andcommitted
now user can name each document loader for ease of tracking (FlowiseAI#4039)
* now user can name each document loader for ease of tracking * Update LoaderConfigPreviewChunks.jsx --------- Co-authored-by: Henry Heng <[email protected]>
1 parent fbc54a9 commit 496ab93

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

packages/ui/src/views/docstore/LoaderConfigPreviewChunks.jsx

+18-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import ReactJson from 'flowise-react-json-view'
99
import useApi from '@/hooks/useApi'
1010

1111
// Material-UI
12-
import { Skeleton, Toolbar, Box, Button, Card, CardContent, Grid, OutlinedInput, Stack, Typography } from '@mui/material'
12+
import { Skeleton, Toolbar, Box, Button, Card, CardContent, Grid, OutlinedInput, Stack, Typography, TextField } from '@mui/material'
1313
import { useTheme, styled } from '@mui/material/styles'
1414
import { IconScissors, IconArrowLeft, IconDatabaseImport, IconBook, IconX, IconEye } from '@tabler/icons-react'
1515

@@ -72,6 +72,7 @@ const LoaderConfigPreviewChunks = () => {
7272

7373
const [loading, setLoading] = useState(false)
7474
const [error, setError] = useState(null)
75+
const [loaderName, setLoaderName] = useState('')
7576

7677
const [textSplitterNodes, setTextSplitterNodes] = useState([])
7778
const [splitterOptions, setTextSplitterOptions] = useState([])
@@ -236,7 +237,7 @@ const LoaderConfigPreviewChunks = () => {
236237

237238
// Set store id & loader name
238239
config.storeId = storeId
239-
config.loaderName = selectedDocumentLoader?.label
240+
config.loaderName = loaderName || selectedDocumentLoader?.label
240241

241242
// Set loader config
242243
if (selectedDocumentLoader.inputs) {
@@ -282,6 +283,7 @@ const LoaderConfigPreviewChunks = () => {
282283
// If this is a document store edit config, set the existing input values
283284
if (existingLoaderFromDocStoreTable && existingLoaderFromDocStoreTable.loaderConfig) {
284285
nodeData.inputs = existingLoaderFromDocStoreTable.loaderConfig
286+
setLoaderName(existingLoaderFromDocStoreTable.loaderName)
285287
}
286288
setSelectedDocumentLoader(nodeData)
287289

@@ -444,6 +446,20 @@ const LoaderConfigPreviewChunks = () => {
444446
paddingRight: 15
445447
}}
446448
>
449+
<Box sx={{ p: 2 }}>
450+
<TextField
451+
fullWidth
452+
sx={{ mt: 1 }}
453+
size='small'
454+
label={
455+
selectedDocumentLoader?.label?.toLowerCase().includes('loader')
456+
? selectedDocumentLoader.label + ' name'
457+
: selectedDocumentLoader?.label + ' Loader Name'
458+
}
459+
value={loaderName}
460+
onChange={(e) => setLoaderName(e.target.value)}
461+
/>
462+
</Box>
447463
{selectedDocumentLoader &&
448464
Object.keys(selectedDocumentLoader).length > 0 &&
449465
(selectedDocumentLoader.inputParams ?? [])

0 commit comments

Comments
 (0)