mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-10 23:55:15 -05:00
[PR #2011] [MERGED] feat: show RAG query results as citations #43909
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/2011
Author: @cheahjs
Created: 5/6/2024
Status: ✅ Merged
Merged: 5/6/2024
Merged by: @tjbck
Base:
dev← Head:feat/rag-citations📝 Commits (10+)
0872beafeat: show RAG query results as citations2571f3cfix: remove stray debug logsc3425f3fix: update translation files4c6567cfeat: group citations by sourcee70cdf1refac: styling38590dafix: styling4c49013refac: styling64ed0d1refac: include source name to citationaef2a51refac: citation renderingc84e0aafix: .env load📊 Changes
35 files changed (+772 additions, -488 deletions)
View changed files
📝
backend/apps/rag/utils.py(+27 -22)📝
backend/config.py(+12 -10)📝
backend/main.py(+36 -3)📝
src/lib/apis/streaming/index.ts(+11 -0)➕
src/lib/components/chat/Messages/CitationsModal.svelte(+75 -0)📝
src/lib/components/chat/Messages/ResponseMessage.svelte(+473 -420)📝
src/lib/i18n/locales/ar-BH/translation.json(+4 -1)📝
src/lib/i18n/locales/bg-BG/translation.json(+4 -1)📝
src/lib/i18n/locales/bn-BD/translation.json(+4 -1)📝
src/lib/i18n/locales/ca-ES/translation.json(+4 -1)📝
src/lib/i18n/locales/de-DE/translation.json(+4 -1)📝
src/lib/i18n/locales/dg-DG/translation.json(+4 -1)📝
src/lib/i18n/locales/en-GB/translation.json(+4 -1)📝
src/lib/i18n/locales/en-US/translation.json(+4 -1)📝
src/lib/i18n/locales/es-ES/translation.json(+4 -1)📝
src/lib/i18n/locales/fa-IR/translation.json(+4 -1)📝
src/lib/i18n/locales/fr-CA/translation.json(+4 -1)📝
src/lib/i18n/locales/fr-FR/translation.json(+4 -1)📝
src/lib/i18n/locales/it-IT/translation.json(+4 -1)📝
src/lib/i18n/locales/ja-JP/translation.json(+4 -1)...and 15 more files
📄 Description
Pull Request Checklist
Description
Return RAG query results as citations to show to the user. This is done by injecting a new event/object into the streaming responses in the RAG middleware, and handling this on the frontend. To avoid breaking external clients, this is an opt-in behaviour with
citations: true.Some open questions:
This is currently not working correctly with collections, as a collection can return multiple documents with different sources in a single query.Code was updated to group by source instead of grouping by collections.Changelog Entry
Added
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.