Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
Target branch: Please verify that the pull request targets the dev branch.
Description: Provide a concise description of the changes made in this pull request.
Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
Testing: Have you written and run sufficient tests for validating the changes?
Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
Prefix: To cleary categorize this pull request, prefix the pull request title, using one of the following:
BREAKING CHANGE: Significant changes that may affect compatibility
build: Changes that affect the build system or external dependencies
ci: Changes to our continuous integration processes or workflows
chore: Refactor, cleanup, or other non-functional code changes
docs: Documentation update or addition
feat: Introduces a new feature or enhancement to the codebase
fix: Bug fix or error correction
i18n: Internationalization or localization changes
perf: Performance improvement
refactor: Code restructuring for better maintainability, readability, or scalability
style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
test: Adding missing tests or correcting existing tests
WIP: Work in progress, a temporary label for incomplete or ongoing work
Changelog Entry
Description
Each document that is part of the chat is stored within the chat data and is part of each chat completion request
With this change this overhead is reduced
For queries with all documents, the collection names are extracted in the backend
For queries with tags, the collection names are extracted in the backend
No change for single file selection
Benefit: Much faster request/response handling. Please see the screenshots of before and after.
Changed
Reduce the request size and chat history storage size by removing the file checksums from the request
Additional Information
Example with 10,000 documents
Browser used: Google Chrome
Environment: Localhost on MacOS
Headers before the change. Request size is 88785. Also the UI was a bit lagging around with computing the payload
Headers after the change. Request size is just 237. UI is very usable
Payload before the change. Quite a long list of checksum in payload
Payload after the change. Just the collection type is required
Timing before the change. Processing the request took 35s
Timing after the change. Processing the request took 8s. Side note: I did also a prove of concept by using just one single collection in ChromaDB and got the request down to under a second (after filling some caches, which is not possible storing it in different collections)
Script used to create the files
for i in {1..100000}
do
echo "Test file $i" > files/"test-$i.txt"
done
🔄 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/3464
**Author:** [@jonathan-rohde](https://github.com/jonathan-rohde)
**Created:** 6/27/2024
**Status:** ❌ Closed
**Base:** `dev` ← **Head:** `feat/reduce-document-selection-overhead`
---
### 📝 Commits (3)
- [`954622b`](https://github.com/open-webui/open-webui/commit/954622b3c7aabf82923a7d9440b6ace3cf5b0b07) feat(chat): Reduce request size to attach file to chat
- [`3925e78`](https://github.com/open-webui/open-webui/commit/3925e78024d91b050885c450823b0ccba5a7fff1) feat(chat): formatting
- [`4d681ec`](https://github.com/open-webui/open-webui/commit/4d681ece5dbbc192d01b7123d20fa45072e3a1ba) feat(chat): rebase changes
### 📊 Changes
**6 files changed** (+82 additions, -21 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/apps/rag/utils.py` (+17 -5)
📝 `backend/apps/webui/models/documents.py` (+9 -0)
📝 `src/lib/components/chat/Chat.svelte` (+12 -4)
📝 `src/lib/components/chat/MessageInput.svelte` (+1 -1)
📝 `src/lib/components/chat/MessageInput/Documents.svelte` (+13 -10)
📝 `src/lib/components/chat/Messages/UserMessage.svelte` (+30 -1)
</details>
### 📄 Description
# Pull Request Checklist
### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request.
**Before submitting, make sure you've checked the following:**
- [x] **Target branch:** Please verify that the pull request targets the `dev` branch.
- [x] **Description:** Provide a concise description of the changes made in this pull request.
- [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description.
- [ ] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources?
- [ ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation?
- [ ] **Testing:** Have you written and run sufficient tests for validating the changes?
- [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
- [x] **Prefix:** To cleary categorize this pull request, prefix the pull request title, using one of the following:
- **BREAKING CHANGE**: Significant changes that may affect compatibility
- **build**: Changes that affect the build system or external dependencies
- **ci**: Changes to our continuous integration processes or workflows
- **chore**: Refactor, cleanup, or other non-functional code changes
- **docs**: Documentation update or addition
- **feat**: Introduces a new feature or enhancement to the codebase
- **fix**: Bug fix or error correction
- **i18n**: Internationalization or localization changes
- **perf**: Performance improvement
- **refactor**: Code restructuring for better maintainability, readability, or scalability
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
- **test**: Adding missing tests or correcting existing tests
- **WIP**: Work in progress, a temporary label for incomplete or ongoing work
# Changelog Entry
### Description
- Each document that is part of the chat is stored within the chat data and is part of each chat completion request
- With this change this overhead is reduced
- For queries with all documents, the collection names are extracted in the backend
- For queries with tags, the collection names are extracted in the backend
- No change for single file selection
- Benefit: Much faster request/response handling. Please see the screenshots of before and after.
### Changed
- Reduce the request size and chat history storage size by removing the file checksums from the request
---
### Additional Information
- *Example with 10,000 documents*
- Browser used: Google Chrome
- Environment: Localhost on MacOS
* Headers before the change. Request size is 88785. Also the UI was a bit lagging around with computing the payload

* Headers after the change. Request size is just 237. UI is very usable

* Payload before the change. Quite a long list of checksum in payload

* Payload after the change. Just the collection type is required

* Timing before the change. Processing the request took 35s

* Timing after the change. Processing the request took 8s. Side note: I did also a prove of concept by using just one single collection in ChromaDB and got the request down to under a second (after filling some caches, which is not possible storing it in different collections)

### Script used to create the files
```
for i in {1..100000}
do
echo "Test file $i" > files/"test-$i.txt"
done
```
---
<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/3464
Author: @jonathan-rohde
Created: 6/27/2024
Status: ❌ Closed
Base:
dev← Head:feat/reduce-document-selection-overhead📝 Commits (3)
954622bfeat(chat): Reduce request size to attach file to chat3925e78feat(chat): formatting4d681ecfeat(chat): rebase changes📊 Changes
6 files changed (+82 additions, -21 deletions)
View changed files
📝
backend/apps/rag/utils.py(+17 -5)📝
backend/apps/webui/models/documents.py(+9 -0)📝
src/lib/components/chat/Chat.svelte(+12 -4)📝
src/lib/components/chat/MessageInput.svelte(+1 -1)📝
src/lib/components/chat/MessageInput/Documents.svelte(+13 -10)📝
src/lib/components/chat/Messages/UserMessage.svelte(+30 -1)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
Changed
Additional Information
Headers before the change. Request size is 88785. Also the UI was a bit lagging around with computing the payload

Headers after the change. Request size is just 237. UI is very usable

Payload before the change. Quite a long list of checksum in payload

Payload after the change. Just the collection type is required

Timing before the change. Processing the request took 35s

Timing after the change. Processing the request took 8s. Side note: I did also a prove of concept by using just one single collection in ChromaDB and got the request down to under a second (after filling some caches, which is not possible storing it in different collections)

Script used to create the files
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.