From 4e7fb81f057628a212871392607fc11602a284ae Mon Sep 17 00:00:00 2001 From: zxstty Date: Mon, 18 Aug 2025 11:04:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dconv=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84bug=EF=BC=9B=E4=B8=AD=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E7=9A=84=E6=9E=9A=E4=B8=BE=E8=B0=83=E6=95=B4=E4=B8=BA?= =?UTF-8?q?zh=E5=92=8Cen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/routers/conversation.py | 18 +++++++++--------- apps/schemas/enum_var.py | 2 +- apps/services/conversation.py | 3 +-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/apps/routers/conversation.py b/apps/routers/conversation.py index 1620ab542..dfb0ce426 100644 --- a/apps/routers/conversation.py +++ b/apps/routers/conversation.py @@ -185,15 +185,15 @@ async def update_conversation( ) # 更新Conversation数据 - change_status = await ConversationManager.update_conversation_by_conversation_id( - user_sub, - conversation_id, - { - "title": post_body.title, - }, - ) - - if not change_status: + try: + await ConversationManager.update_conversation_by_conversation_id( + user_sub, + conversation_id, + { + "title": post_body.title, + }, + ) + except Exception as e: return JSONResponse( status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, content=ResponseData( diff --git a/apps/schemas/enum_var.py b/apps/schemas/enum_var.py index f76e75028..e7ecf87c3 100644 --- a/apps/schemas/enum_var.py +++ b/apps/schemas/enum_var.py @@ -213,6 +213,6 @@ class AgentState(str, Enum): class LanguageType(str, Enum): """语言类型""" - CHINESE = "zh_cn" + CHINESE = "zh" ENGLISH = "en" diff --git a/apps/services/conversation.py b/apps/services/conversation.py index 6bacb7272..02fa2b52e 100644 --- a/apps/services/conversation.py +++ b/apps/services/conversation.py @@ -113,11 +113,10 @@ class ConversationManager: """通过ConversationID更新对话信息""" mongo = MongoDB() conv_collection = mongo.get_collection("conversation") - result = await conv_collection.update_one( + await conv_collection.update_one( {"_id": conversation_id, "user_sub": user_sub}, {"$set": data}, ) - return result.modified_count > 0 @staticmethod async def delete_conversation_by_conversation_id(user_sub: str, conversation_id: str) -> None: -- Gitee