Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

now user can name each document loader for ease of tracking #4039

Merged
merged 2 commits into from
Feb 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions packages/ui/src/views/docstore/LoaderConfigPreviewChunks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ReactJson from 'flowise-react-json-view'
import useApi from '@/hooks/useApi'

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

Expand Down Expand Up @@ -72,6 +72,7 @@ const LoaderConfigPreviewChunks = () => {

const [loading, setLoading] = useState(false)
const [error, setError] = useState(null)
const [loaderName, setLoaderName] = useState('')

const [textSplitterNodes, setTextSplitterNodes] = useState([])
const [splitterOptions, setTextSplitterOptions] = useState([])
Expand Down Expand Up @@ -236,7 +237,7 @@ const LoaderConfigPreviewChunks = () => {

// Set store id & loader name
config.storeId = storeId
config.loaderName = selectedDocumentLoader?.label
config.loaderName = loaderName || selectedDocumentLoader?.label

// Set loader config
if (selectedDocumentLoader.inputs) {
Expand Down Expand Up @@ -282,6 +283,7 @@ const LoaderConfigPreviewChunks = () => {
// If this is a document store edit config, set the existing input values
if (existingLoaderFromDocStoreTable && existingLoaderFromDocStoreTable.loaderConfig) {
nodeData.inputs = existingLoaderFromDocStoreTable.loaderConfig
setLoaderName(existingLoaderFromDocStoreTable.loaderName)
}
setSelectedDocumentLoader(nodeData)

Expand Down Expand Up @@ -444,6 +446,20 @@ const LoaderConfigPreviewChunks = () => {
paddingRight: 15
}}
>
<Box sx={{ p: 2 }}>
<TextField
fullWidth
sx={{ mt: 1 }}
size='small'
label={
selectedDocumentLoader?.label?.toLowerCase().includes('loader')
? selectedDocumentLoader.label + ' name'
: selectedDocumentLoader?.label + ' Loader Name'
}
value={loaderName}
onChange={(e) => setLoaderName(e.target.value)}
/>
</Box>
{selectedDocumentLoader &&
Object.keys(selectedDocumentLoader).length > 0 &&
(selectedDocumentLoader.inputParams ?? [])
Expand Down