diff --git a/backend/apps/chat/api/chat.py b/backend/apps/chat/api/chat.py index acb5608a..3517eef8 100644 --- a/backend/apps/chat/api/chat.py +++ b/backend/apps/chat/api/chat.py @@ -63,7 +63,7 @@ async def start_chat(session: SessionDep, current_user: CurrentUser, create_chat return create_chat(session, current_user, create_chat_obj) except Exception as e: raise HTTPException( - status_code=400, + status_code=500, detail=str(e) ) diff --git a/backend/apps/chat/curd/chat.py b/backend/apps/chat/curd/chat.py index 9f9be02e..f3c69256 100644 --- a/backend/apps/chat/curd/chat.py +++ b/backend/apps/chat/curd/chat.py @@ -79,7 +79,7 @@ def create_chat(session: SessionDep, current_user: CurrentUser, create_chat_obj: raise Exception("Datasource cannot be None") if not create_chat_obj.question or create_chat_obj.question.strip() == '': - raise Exception("Question cannot be Empty") + create_chat_obj.question = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") chat = Chat(create_time=datetime.datetime.now(), create_by=current_user.id, diff --git a/backend/apps/chat/models/chat_model.py b/backend/apps/chat/models/chat_model.py index e6c51fca..43d3bea3 100644 --- a/backend/apps/chat/models/chat_model.py +++ b/backend/apps/chat/models/chat_model.py @@ -52,7 +52,7 @@ class ChatRecord(SQLModel, table=True): class CreateChat(BaseModel): id: int = None - question: str = '' + question: str = None datasource: int = None diff --git a/frontend/src/views/chat/ChatCreator.vue b/frontend/src/views/chat/ChatCreator.vue new file mode 100644 index 00000000..1430a78f --- /dev/null +++ b/frontend/src/views/chat/ChatCreator.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/frontend/src/views/chat/index.vue b/frontend/src/views/chat/index.vue index 7f6f0878..d2621287 100644 --- a/frontend/src/views/chat/index.vue +++ b/frontend/src/views/chat/index.vue @@ -24,7 +24,20 @@ - +
+
+ +
{{ t('qa.greeting') }}
+
{{ t('qa.description') }}
+ + + + + {{ t('qa.New Conversation') }} + +
+
+