mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #13358] [MERGED] fix: install external requirements of tools and functions to prevent deactivation #38794
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/13358
Author: @almajo
Created: 4/30/2025
Status: ✅ Merged
Merged: 4/30/2025
Merged by: @tjbck
Base:
dev← Head:fix/load_ext_dependencies_on_startup📝 Commits (1)
e80ed32fix: install external requirements of admin functions and tools on startups📊 Changes
2 files changed (+40 additions, -2 deletions)
View changed files
📝
backend/open_webui/main.py(+9 -1)📝
backend/open_webui/utils/plugin.py(+31 -1)📄 Description
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
Bug: #12121
This PR installs requirements of active functions and admin tools on startup. This prevents automatically deactivating due to missing requirements them after the container has been restarted.
I'm happy to discuss the decisions I made here.
Decisions
Blocking call
I decided to go for a blocking operation, i.e. the API is only functional after the requirements are installed or it failed with an error log. The reason is to prevent conurruency issues with users. When the get_models is called and the function is not working because of missing requirements it will get automatically deactivated. All while the requirements are actually installed in the background.
This should not be noticeable at all in practice, maybe add an extra startup time of 1-10 seconds to the applications (if many requirements are present.
Only active functions and admin tools
I decided to only go for active functions in order to be able to deactivate a (maybe not-working) function at any time and not have any impact of active functions. This reduces the risk of dependency problems between the tools and functions.
Only installing requirements of admin functions (
user.role == admin), we prevent possible dependency resolution issues or dependency injections from user tools, directly on startup.Changed
Fixed
Tests
Following the reproduction steps in #12121 I was able to solve this issue and active functions with requirements remain active and working while others remain untouched.
If anything fails in this method, it is only logged and there is no change to before this PR.
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the CONTRIBUTOR_LICENSE_AGREEMENT, 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.