(file, vectorStoreConfig, recordManagerConfig)
| 283 | } |
| 284 | |
| 285 | const onLoaderDelete = (file, vectorStoreConfig, recordManagerConfig) => { |
| 286 | // Get the display name in the format "LoaderName (sourceName)" |
| 287 | const loaderName = file.loaderName || 'Unknown' |
| 288 | let sourceName = '' |
| 289 | |
| 290 | // Prefer files.name when files array exists and has items |
| 291 | if (file.files && Array.isArray(file.files) && file.files.length > 0) { |
| 292 | sourceName = file.files.map((f) => f.name).join(', ') |
| 293 | } else if (file.source) { |
| 294 | // Fallback to source logic |
| 295 | if (typeof file.source === 'string' && file.source.includes('base64')) { |
| 296 | sourceName = getFileName(file.source) |
| 297 | } else if (typeof file.source === 'string' && file.source.startsWith('[') && file.source.endsWith(']')) { |
| 298 | sourceName = JSON.parse(file.source).join(', ') |
| 299 | } else if (typeof file.source === 'string') { |
| 300 | sourceName = file.source |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | const displayName = sourceName ? `${loaderName} (${sourceName})` : loaderName |
| 305 | |
| 306 | let description = `Delete "${displayName}"? This will delete all the associated document chunks from the document store.` |
| 307 | |
| 308 | if ( |
| 309 | recordManagerConfig && |
| 310 | vectorStoreConfig && |
| 311 | Object.keys(recordManagerConfig).length > 0 && |
| 312 | Object.keys(vectorStoreConfig).length > 0 |
| 313 | ) { |
| 314 | description = `Delete "${displayName}"? This will delete all the associated document chunks from the document store and remove the actual data from the vector store database.` |
| 315 | } |
| 316 | |
| 317 | const props = { |
| 318 | title: `Delete`, |
| 319 | description, |
| 320 | vectorStoreConfig, |
| 321 | recordManagerConfig, |
| 322 | type: 'LOADER', |
| 323 | file |
| 324 | } |
| 325 | |
| 326 | setDeleteDocStoreDialogProps(props) |
| 327 | setShowDeleteDocStoreDialog(true) |
| 328 | } |
| 329 | |
| 330 | const onStoreDelete = (vectorStoreConfig, recordManagerConfig) => { |
| 331 | let description = `Delete Store ${getSpecificDocumentStore.data?.name}? This will delete all the associated loaders and document chunks from the document store.` |
no test coverage detected