[PR #12095] [CLOSED] perf: optimize get_models #22848

Closed
opened 2026-04-20 04:26:40 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/12095
Author: @yvedeng
Created: 3/26/2025
Status: Closed

Base: devHead: yvedeng/optimize-models-endpoint


📝 Commits (1)

  • c87b935 perf: optimize get_models

📊 Changes

4 files changed (+9 additions, -6 deletions)

View changed files

backend/open_webui/conftest.py (+4 -0)
📝 backend/open_webui/models/models.py (+2 -3)
📝 backend/open_webui/test/apps/webui/routers/test_models.py (+2 -2)
📝 backend/open_webui/test/util/mock_user.py (+1 -1)

📄 Description

Changelog Entry

Description

This is to improve the performance of the DB query for the get_models() function.

Given that we have N models, we can reduce the number of DB queries from 1 + N (for retrieving the users) to 1.

Changed

  • Refactored get_models() function
  • Fixed models test

🔄 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/12095 **Author:** [@yvedeng](https://github.com/yvedeng) **Created:** 3/26/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `yvedeng/optimize-models-endpoint` --- ### 📝 Commits (1) - [`c87b935`](https://github.com/open-webui/open-webui/commit/c87b9355822aef01fc275d64cdbfbe8793ba22ec) perf: optimize get_models ### 📊 Changes **4 files changed** (+9 additions, -6 deletions) <details> <summary>View changed files</summary> ➕ `backend/open_webui/conftest.py` (+4 -0) 📝 `backend/open_webui/models/models.py` (+2 -3) 📝 `backend/open_webui/test/apps/webui/routers/test_models.py` (+2 -2) 📝 `backend/open_webui/test/util/mock_user.py` (+1 -1) </details> ### 📄 Description # Changelog Entry ### Description This is to improve the performance of the DB query for the get_models() function. Given that we have N models, we can reduce the number of DB queries from 1 + N (for retrieving the users) to 1. ### Changed - Refactored get_models() function - Fixed models test --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 04:26:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#22848