mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 08:21:12 -05:00
[PR #12667] [CLOSED] perf: Prevent model list API call from blocking UI #9796
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/12667
Author: @thearyadev
Created: 4/9/2025
Status: ❌ Closed
Base:
dev← Head:async-model-list📝 Commits (2)
9f228d2fix: prevent model list api call from blocking uidf274e3fix: refactor models.subscribe use📊 Changes
2 files changed (+28 additions, -6 deletions)
View changed files
📝
src/lib/components/chat/Chat.svelte(+22 -0)📝
src/routes/(app)/+layout.svelte(+6 -6)📄 Description
Changelog Entry
Description
The API call to
/api/modelscan take a long time. the ui waits until the api call promise is resolved before continuing any other ui state change or conducting any other api call. user sees a blank screen until the request has completed. This PR allows for the models list api call to run without blocking the UI.This delay can become large if there are many model api urls, or if the servers are offline/are responding slowly.
Changed
modelsstore asynchronously to prevent UI blockingsrc/lib/components/chat/Chat.svelteonMount subscribes tomodelsand runs theinitNewChatfunction whenmodelschanges, ensuring the UI is hydrated with the new data.Additional Information
tested by adding an artificial delay to the endpoint
/api/modelsinbackend/open_webui/main.py:before:
this video demonstrates the blank UI while the call to
/api/modelscompleteshttps://github.com/user-attachments/assets/a26ad416-38c0-4606-91b9-5108185b1bd3
after:
when the api call is done without blocking, the user gets a quick load, and is able to interact with the ui while the request completes in the background.
https://github.com/user-attachments/assets/1b03d5df-4593-4ba1-81e8-b0e33f0e942f
user navigates during model load functions as intended.
the initNewChat function is not called if the user navigates. The model list is still refreshed once it becomes available.
https://github.com/user-attachments/assets/b509e839-bd7a-44a8-9b78-86dbd2885367
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.