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 to validate 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 clearly 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
This pull request optimizes the chat import functionality by replacing the one-by-one import process with a bulk import endpoint. Previously, importing a file containing multiple chats would trigger a separate API request for each chat, leading to slow performance and high network traffic. With this change, all chats from the imported file are sent to the server in a single request, significantly improving the speed and efficiency of the import process. A toast notification has also been added to inform the user of the number of chats successfully imported.
Added
A new backend endpoint, /chats/import/bulk, to handle the import of multiple chats in a single transaction.
A new function, import_chats_in_bulk, in backend/open_webui/models/chats.py to support efficient bulk database insertion.
A new frontend API function, importChatsInBulk, in src/lib/apis/chats/index.ts to communicate with the new bulk endpoint.
A toast notification in src/lib/components/chat/Settings/DataControls.svelte that displays the number of chats successfully imported.
Changed
Refactored the importChats function in src/lib/components/chat/Settings/DataControls.svelte to use the new bulk import API instead of iterating through chats individually.
Removed
The inefficient, iterative chat import logic on the frontend that made individual API calls for each chat.
Fixed
A significant performance bottleneck in the chat import feature, especially noticeable when importing large numbers of chats.
Additional Information
This change directly addresses the performance issues related to importing chats from a JSON file, providing a much smoother user experience.
Screenshots or Videos
Time to import many chats previously (MANY REQUESTS, VERY SLOW, NO FEEDBACK):
Time to import many chats with these changes applied (FAR FEWER REQUESTS, SMALLER TRANSFER, MUCH FASTER, FEEDBACK OF SUCCESS):
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 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/17861
**Author:** [@silentoplayz](https://github.com/silentoplayz)
**Created:** 9/28/2025
**Status:** ❌ Closed
**Base:** `dev` ← **Head:** `move-import-chats-to-backend`
---
### 📝 Commits (3)
- [`aa14834`](https://github.com/open-webui/open-webui/commit/aa1483473a2fc721709d9483e4aa0d5b18f123fb) feat: implement bulk chat import for massive speedup for chat imports
- [`b403e30`](https://github.com/open-webui/open-webui/commit/b403e3015e595a9783a5ebce700fca4f4c6d9fd5) feat: add toast notification
- [`3545d15`](https://github.com/open-webui/open-webui/commit/3545d1598f96eab3d2cd4cbd163cadd6d310ce46) fix: imported chats in folders
### 📊 Changes
**4 files changed** (+116 additions, -14 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/models/chats.py` (+45 -0)
📝 `backend/open_webui/routers/chats.py` (+18 -0)
📝 `src/lib/apis/chats/index.ts` (+31 -0)
📝 `src/lib/components/chat/Settings/DataControls.svelte` (+22 -14)
</details>
### 📄 Description
# Pull Request Checklist
- [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.
- [X] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources?
- [X] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation?
- [X] **Testing:** Have you written and run sufficient tests to validate 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 clearly 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
- This pull request optimizes the chat import functionality by replacing the one-by-one import process with a bulk import endpoint. Previously, importing a file containing multiple chats would trigger a separate API request for each chat, leading to slow performance and high network traffic. With this change, all chats from the imported file are sent to the server in a single request, significantly improving the speed and efficiency of the import process. A toast notification has also been added to inform the user of the number of chats successfully imported.
### Added
- A new backend endpoint, `/chats/import/bulk`, to handle the import of multiple chats in a single transaction.
- A new function, `import_chats_in_bulk`, in `backend/open_webui/models/chats.py` to support efficient bulk database insertion.
- A new frontend API function, `importChatsInBulk`, in `src/lib/apis/chats/index.ts` to communicate with the new bulk endpoint.
- A toast notification in `src/lib/components/chat/Settings/DataControls.svelte` that displays the number of chats successfully imported.
### Changed
- Refactored the `importChats` function in `src/lib/components/chat/Settings/DataControls.svelte` to use the new bulk import API instead of iterating through chats individually.
### Removed
- The inefficient, iterative chat import logic on the frontend that made individual API calls for each chat.
### Fixed
- A significant performance bottleneck in the chat import feature, especially noticeable when importing large numbers of chats.
### Additional Information
- This change directly addresses the performance issues related to importing chats from a JSON file, providing a much smoother user experience.
### Screenshots or Videos
**Time to import many chats previously (MANY REQUESTS, VERY SLOW, NO FEEDBACK):**
<img width="2558" height="1274" alt="image" src="https://github.com/user-attachments/assets/6ed879ed-d1dc-48f2-9004-7efb5b36ad52" />
**Time to import many chats with these changes applied (FAR FEWER REQUESTS, SMALLER TRANSFER, MUCH FASTER, FEEDBACK OF SUCCESS):**
<img width="2558" height="1274" alt="image" src="https://github.com/user-attachments/assets/ae6f9cfc-8930-46c5-aa9c-dd694e07f7e4" />
### Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms.
---
<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/17861
Author: @silentoplayz
Created: 9/28/2025
Status: ❌ Closed
Base:
dev← Head:move-import-chats-to-backend📝 Commits (3)
aa14834feat: implement bulk chat import for massive speedup for chat importsb403e30feat: add toast notification3545d15fix: imported chats in folders📊 Changes
4 files changed (+116 additions, -14 deletions)
View changed files
📝
backend/open_webui/models/chats.py(+45 -0)📝
backend/open_webui/routers/chats.py(+18 -0)📝
src/lib/apis/chats/index.ts(+31 -0)📝
src/lib/components/chat/Settings/DataControls.svelte(+22 -14)📄 Description
Pull Request Checklist
devbranch.Changelog Entry
Description
Added
/chats/import/bulk, to handle the import of multiple chats in a single transaction.import_chats_in_bulk, inbackend/open_webui/models/chats.pyto support efficient bulk database insertion.importChatsInBulk, insrc/lib/apis/chats/index.tsto communicate with the new bulk endpoint.src/lib/components/chat/Settings/DataControls.sveltethat displays the number of chats successfully imported.Changed
importChatsfunction insrc/lib/components/chat/Settings/DataControls.svelteto use the new bulk import API instead of iterating through chats individually.Removed
Fixed
Additional Information
Screenshots or Videos
Time to import many chats previously (MANY REQUESTS, VERY SLOW, NO FEEDBACK):

Time to import many chats with these changes applied (FAR FEWER REQUESTS, SMALLER TRANSFER, MUCH FASTER, FEEDBACK OF SUCCESS):

Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.