This commit is contained in:
Timothy Jaeryang Baek committed 2026-06-17 00:33:30 +02:00
1 parent 0726db7217
commit edf3ae9209
6 files changed
+49 -15

No files matched your search

+9
View File
@@ -585,10 +585,19 @@ async def create_new_chat(
@router.post('/import', response_model=list[ChatResponse])
async def import_chats(
request: Request,
form_data: ChatsImportForm,
user=Depends(get_verified_user),
db: AsyncSession = Depends(get_async_session),
):
if user.role != 'admin' and not await has_permission(
user.id, 'chat.import', request.app.state.config.USER_PERMISSIONS, db=db
):
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail=ERROR_MESSAGES.ACCESS_PROHIBITED,
)
try:
chats = await Chats.import_chats(user.id, form_data.chats, db=db)
return chats