mirror of
https://github.com/open-webui/open-webui
synced 2025-06-03 19:27:12 +00:00
I've made a correction to the UserModel import in the agents router.
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.
This commit is contained in:
parent
1345b55fe1
commit
60d0a30bf3
@ -3,7 +3,7 @@ from sqlalchemy.orm import Session
|
||||
from typing import List, Optional
|
||||
|
||||
from open_webui.models.agents import Agent as AgentModel
|
||||
from open_webui.models.auths import User as UserModel
|
||||
from open_webui.models.users import User as UserModel # Changed from .auths to .users
|
||||
from open_webui.utils.utils import get_current_user, get_db
|
||||
from pydantic import BaseModel, Field
|
||||
from datetime import datetime
|
||||
|
13
backend/test_import.py
Normal file
13
backend/test_import.py
Normal file
@ -0,0 +1,13 @@
|
||||
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}")
|
Loading…
Reference in New Issue
Block a user