Skip to content

Commit

Permalink
fix linter failures
Browse files Browse the repository at this point in the history
  • Loading branch information
esxr committed Apr 26, 2024
1 parent 1793551 commit 01e10e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 4 additions & 2 deletions backend/app/api/assistants.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ async def delete_assistant(
assistant = await storage.get_assistant(user["user_id"], aid)
if not assistant:
raise HTTPException(status_code=404, detail="Assistant not found")
if not assistant.get('public') and assistant.get('user_id') != user["user_id"]:
raise HTTPException(status_code=403, detail="Unauthorized to delete this assistant")
if not assistant.get("public") and assistant.get("user_id") != user["user_id"]:
raise HTTPException(
status_code=403, detail="Unauthorized to delete this assistant"
)
await storage.delete_assistant(user["user_id"], aid)
return {"status": "ok"}
10 changes: 2 additions & 8 deletions backend/app/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,10 @@ async def delete_thread(user_id: str, thread_id: str):


async def delete_assistant(user_id: str, assistant_id: str):
"""Delete an assistant by ID.
Args:
user_id: The user's ID.
assistant_id: The assistant's ID.
"""
"""Delete an assistant by ID."""
async with get_pg_pool().acquire() as conn:
await conn.execute(
"DELETE FROM assistant WHERE assistant_id = $1 AND user_id = $2",
assistant_id,
user_id,
)
)

0 comments on commit 01e10e5

Please sign in to comment.