Relevance Score for Citations: Citations now display a relevance score in both percentage and float distance formats. Sorted Citations: Citations under the message are now sorted by relevance (e.g., source 1, source 2...). -> Already implemented in the backend
Compact Source Display: For more than 3 sources, a cleaner source display is shown under the message.
Other Embedding Engines than Ollama: OpenAI Embedding, Dafault integrated ones
If only one distance is in cosine similarity range -1 to 1
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/5989
**Author:** [@jannikstdl](https://github.com/jannikstdl)
**Created:** 10/7/2024
**Status:** ✅ Merged
**Merged:** 10/17/2024
**Merged by:** [@tjbck](https://github.com/tjbck)
**Base:** `dev` ← **Head:** `dev`
---
### 📝 Commits (10+)
- [`86caca4`](https://github.com/open-webui/open-webui/commit/86caca495bd698e7d96d8f1bf7b142875903d068) enh: show source documents vector distance + cleaner source view
- [`b105efa`](https://github.com/open-webui/open-webui/commit/b105efa05f05f6bf6cd79ae80cb3b30e473e9a3b) enh: append citations with distance scores
- [`9fc813c`](https://github.com/open-webui/open-webui/commit/9fc813cfa6e1967afc1ee758725b60b6539679b2) fix: only append if distances are available
- [`209948a`](https://github.com/open-webui/open-webui/commit/209948af6fd4bd2f0b0790fb1a6cbea0c6d5ef0e) styling
- [`73c2911`](https://github.com/open-webui/open-webui/commit/73c291193b8d18030cbee35fbcfe5b483810576c) fix: do not toggle collapsible if you click on a citation
- [`89c77f0`](https://github.com/open-webui/open-webui/commit/89c77f05a8d4f6aef320c37983fe051d41c94c97) chromadb switch to cosine similarity
- [`741230b`](https://github.com/open-webui/open-webui/commit/741230bcdbf8ea6cc8d673e61cc712efd96e6bb8) fix
- [`9d4d964`](https://github.com/open-webui/open-webui/commit/9d4d96429f22ad943115df5c04907ee84e76c468) only show relevance pertentage score if distances are in cosinus silimarity range
- [`0bebc89`](https://github.com/open-webui/open-webui/commit/0bebc898c84c95d00d9dc5873f56448f544e975a) finalizing fixes & additions
- [`f47c9c6`](https://github.com/open-webui/open-webui/commit/f47c9c69e3ac4ec6f3cc56efe056364f52272cfe) Merge branch 'upstream-dev' into dev
### 📊 Changes
**6 files changed** (+289 additions, -70 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/apps/retrieval/utils.py` (+8 -7)
📝 `backend/open_webui/apps/retrieval/vector/dbs/chroma.py` (+8 -2)
📝 `src/lib/components/chat/Messages/Citations.svelte` (+201 -49)
📝 `src/lib/components/chat/Messages/CitationsModal.svelte` (+66 -8)
📝 `src/lib/components/common/Collapsible.svelte` (+3 -3)
📝 `src/lib/i18n/locales/de-DE/translation.json` (+3 -1)
</details>
### 📄 Description
### Description
This PR includes the following key changes:
- **Relevance Score for Citations:** Citations now display a relevance score in both percentage and float distance formats.
~~**Sorted Citations:** Citations under the message are now sorted by relevance (e.g., source 1, source 2...).~~ -> Already implemented in the backend
- **Compact Source Display:** For more than 3 sources, a cleaner source display is shown under the message.
**Relevance Score for Citations:**

**Compact Source Display:**
https://github.com/user-attachments/assets/848300f3-edef-4074-b2d5-d5ba9c680714
**Testing**
- [x] Milvus DB
- [x] If error / distances are not available
- [x] Other Embedding Engines than Ollama: OpenAI Embedding, Dafault integrated ones
- [x] If only one distance is in cosine similarity range -1 to 1
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/5989
Author: @jannikstdl
Created: 10/7/2024
Status: ✅ Merged
Merged: 10/17/2024
Merged by: @tjbck
Base:
dev← Head:dev📝 Commits (10+)
86caca4enh: show source documents vector distance + cleaner source viewb105efaenh: append citations with distance scores9fc813cfix: only append if distances are available209948astyling73c2911fix: do not toggle collapsible if you click on a citation89c77f0chromadb switch to cosine similarity741230bfix9d4d964only show relevance pertentage score if distances are in cosinus silimarity range0bebc89finalizing fixes & additionsf47c9c6Merge branch 'upstream-dev' into dev📊 Changes
6 files changed (+289 additions, -70 deletions)
View changed files
📝
backend/open_webui/apps/retrieval/utils.py(+8 -7)📝
backend/open_webui/apps/retrieval/vector/dbs/chroma.py(+8 -2)📝
src/lib/components/chat/Messages/Citations.svelte(+201 -49)📝
src/lib/components/chat/Messages/CitationsModal.svelte(+66 -8)📝
src/lib/components/common/Collapsible.svelte(+3 -3)📝
src/lib/i18n/locales/de-DE/translation.json(+3 -1)📄 Description
Description
This PR includes the following key changes:
Sorted Citations: Citations under the message are now sorted by relevance (e.g., source 1, source 2...).-> Already implemented in the backendRelevance Score for Citations:

Compact Source Display:
https://github.com/user-attachments/assets/848300f3-edef-4074-b2d5-d5ba9c680714
Testing
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.