mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #23046] [CLOSED] fix: add pagination to chat list endpoints to prevent OOM #65851
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/23046
Author: @yang1002378395-cmyk
Created: 3/26/2026
Status: ❌ Closed
Base:
dev← Head:fix-oom-pagination📝 Commits (1)
efb0f9afix: add pagination to chat list endpoints to prevent OOM📊 Changes
2 files changed (+34 additions, -15 deletions)
View changed files
📝
backend/open_webui/models/chats.py(+19 -9)📝
backend/open_webui/routers/chats.py(+15 -6)📄 Description
Summary
Fixes #22206
Adds pagination to chat list endpoints to prevent Out of Memory (OOM) crashes when users have large numbers of chats.
Problem
When calling
/api/v1/chats/allor/api/v1/chats/all/archivedwithout pagination, the server loads ALL chats into memory. For users with thousands of chats, this can cause OOM crashes.Changes
skipandlimitparameters toget_chats()andget_archived_chats_by_user_id()/chats/all,/chats/all/archived,/chats/all/dbendpoints with pagination parametersAPI Changes
Testing
Tested locally with:
Related
Based on closed PR #22464 with formatting fixes.
Contributor License Agreement
By submitting this pull request, I confirm that my contributions are made under the Apache 2.0 license.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.