Ai management rag enhancements #21816
BackSummary
- Rename the RAG tool to
search_documentsfor clearer tool-calling behavior. - Fix data source deletion so cleanup is complete: vector embeddings + document chunks + blob are removed, preventing deleted files from appearing in search results.
- Introduce
WorkspaceDataSourceOptionsto make upload validation configurable (allowed extensions, max file size, and content type mapping) instead of hardcoded values.
Technical Changes
WorkspaceDataSourceAppService.DeleteAsyncnow delegates deletion logic toWorkspaceDataSourceManager.DeleteAsync.WorkspaceDataSourceManager.DeleteAsyncnow:- Deletes vector embeddings for processed data sources.
- Gracefully skips vector cleanup when vector store provider is not configured/found.
- Deletes document chunks, blob data, and the data source entity.
- Upload validation/UI now use
IOptions<WorkspaceDataSourceOptions>across:- Application service
- Blazor workspace data source page
- MVC upload modal
- Localizations updated to parameterized values for:
AllowedFileTypesMaxFileSize
- Added/updated unit tests:
WorkspaceDataSourceManager_TestsWorkspaceDataSourceOptions_Tests
How to Test
- Run automated tests:
dotnet test test/Volo.AIManagement.Domain.Testsdotnet test test/Volo.AIManagement.Application.Testsdotnet test test/Volo.AIManagement.EntityFrameworkCore.Tests
- Verify data source deletion cleanup:
- Upload and index a data source in a workspace with vector store configured.
- Confirm document search returns results from that file.
- Delete the data source from UI.
- Confirm document search no longer returns content from deleted file.
- Verify configurable upload options:
- Configure
WorkspaceDataSourceOptionswith custom values (e.g., lowerMaxFileSizeand different extensions). - Confirm validation messages and UI accept behavior follow configured values.
- Configure
Checklist
- I fully tested it as developer / designer and created unit / integration tests
- I documented it (or no need to document or I will create a separate documentation issue)
- I worked with the design team to get their idea for UI/UX design (or no need to design for this PR)
- I've assigned reviewer, related labels and set a milestone for this PR