Skip to content

Commit

Permalink
fix(backend): fix chat endpoint when chat id does not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
wd0517 committed Jan 7, 2025
1 parent 25d01a2 commit 414d9c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backend/app/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from http import HTTPStatus
from uuid import UUID

from fastapi import HTTPException

# Common
Expand All @@ -19,7 +21,7 @@ class ChatException(HTTPException):
class ChatNotFound(ChatException):
status_code = 404

def __init__(self, chat_id: int):
def __init__(self, chat_id: UUID):
self.detail = f"chat #{chat_id} is not found"


Expand Down
2 changes: 1 addition & 1 deletion backend/app/rag/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def __init__(
# anonymous user can only access anonymous chat by track_id
self.db_chat_obj = chat_repo.get(self.db_session, chat_id)
if not self.db_chat_obj:
raise ChatNotFound()
raise ChatNotFound(chat_id)
try:
self.chat_engine_config = ChatEngineConfig.load_from_db(
db_session, self.db_chat_obj.engine.name
Expand Down

0 comments on commit 414d9c3

Please sign in to comment.