Add RAG sources to chat responses and UI #21689

Back

Expose and propagate RAG (retrieval-augmented generation) source metadata through the stack so clients can display provenance for assistant responses. Adds AIChatRagSourceDto / ChatRagSourceDto DTOs and mapper, includes RagSources on integration and client response/update DTOs, and extracts sources in AIChatCompletionIntegrationService (streamed updates and final response). Introduces IRagSourceCollector and a scoped RagSourceCollector implementation to collect chunks during search/tool execution; DocumentSearchService now adds found sources to the collector. RagService and IndexDocumentJob include file_name metadata when indexing/searching. UI updates: Blazor component and client JS render collapsible source lists; localization key for "AIChat:Sources" added. This enables showing file name, chunk index, similarity score and content preview for RAG context in the chat UI.

rag-sources

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
Version
10.2.0-rc.2
Release Date
09 March, 2026
Labels
abp-module-ai-management ui-mvc ui-blazor
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.