mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
This resolved an ImportError (cannot import name 'User' from 'open_webui.models.auths') by changing the import for UserModel in `backend/open_webui/routers/agents.py` to correctly point to `open_webui.models.users`. The original error prevented the agents router from loading. This change ensures the router can find the correct User model definition. Note: I also found a missing 'typer' dependency, which I will address next.
14 lines
430 B
Python
14 lines
430 B
Python
import sys
|
|
import os
|
|
|
|
# Add the backend directory to sys.path to allow direct import of open_webui
|
|
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
|
|
|
|
try:
|
|
from open_webui.routers.agents import router as agents_router
|
|
print("Successfully imported agents_router!")
|
|
except ImportError as e:
|
|
print(f"Failed to import agents_router: {e}")
|
|
except Exception as e:
|
|
print(f"An unexpected error occurred: {e}")
|