refac
This commit is contained in:
1 parent
67a7b23b85
commit
396d9ac181
8 files changed
+75
-35
No files matched your search
@@ -22,6 +22,7 @@ from open_webui.models.models import Models
|
||||
from open_webui.models.tools import Tools
|
||||
from open_webui.models.users import UserInfoResponse, Users
|
||||
from open_webui.utils.auth import get_admin_user, get_verified_user
|
||||
from open_webui.utils.errors import error_detail
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -87,7 +88,7 @@ async def create_new_group(
|
||||
log.exception(f'Error creating a new group: {e}')
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail=ERROR_MESSAGES.DEFAULT(e),
|
||||
detail=error_detail(e, 'Error creating group'),
|
||||
)
|
||||
|
||||
|
||||
@@ -166,7 +167,7 @@ async def get_users_in_group(id: str, user=Depends(get_admin_user), db: AsyncSes
|
||||
log.exception(f'Error adding users to group {id}: {e}')
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail=ERROR_MESSAGES.DEFAULT(e),
|
||||
detail=error_detail(e, 'Error getting group members'),
|
||||
)
|
||||
|
||||
|
||||
@@ -206,7 +207,7 @@ async def update_group_by_id(
|
||||
log.exception(f'Error updating group {id}: {e}')
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail=ERROR_MESSAGES.DEFAULT(e),
|
||||
detail=error_detail(e, 'Error updating group'),
|
||||
)
|
||||
|
||||
|
||||
@@ -249,7 +250,7 @@ async def add_user_to_group(
|
||||
log.exception(f'Error adding users to group {id}: {e}')
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail=ERROR_MESSAGES.DEFAULT(e),
|
||||
detail=error_detail(e, 'Error adding users to group'),
|
||||
)
|
||||
|
||||
|
||||
@@ -284,7 +285,7 @@ async def remove_users_from_group(
|
||||
log.exception(f'Error removing users from group {id}: {e}')
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail=ERROR_MESSAGES.DEFAULT(e),
|
||||
detail=error_detail(e, 'Error removing users from group'),
|
||||
)
|
||||
|
||||
|
||||
@@ -316,7 +317,7 @@ async def delete_group_by_id(
|
||||
log.exception(f'Error deleting group {id}: {e}')
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail=ERROR_MESSAGES.DEFAULT(e),
|
||||
detail=error_detail(e, 'Error deleting group'),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user