From 5008f5e89bcba4388754b81b4c0aae1b009ab64f Mon Sep 17 00:00:00 2001 From: wangxiaolei Date: Thu, 15 Jan 2026 09:51:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Use=20raw=20SQL=20UPDATE=20to=20set=20re?= =?UTF-8?q?ad=20status=20without=20triggering=20updated=E2=80=A6=20(#31015?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/controllers/console/app/conversation.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/api/controllers/console/app/conversation.py b/api/controllers/console/app/conversation.py index 56816dd462..55fdcb51e4 100644 --- a/api/controllers/console/app/conversation.py +++ b/api/controllers/console/app/conversation.py @@ -592,9 +592,12 @@ def _get_conversation(app_model, conversation_id): if not conversation: raise NotFound("Conversation Not Exists.") - if not conversation.read_at: - conversation.read_at = naive_utc_now() - conversation.read_account_id = current_user.id - db.session.commit() + db.session.execute( + sa.update(Conversation) + .where(Conversation.id == conversation_id, Conversation.read_at.is_(None)) + .values(read_at=naive_utc_now(), read_account_id=current_user.id) + ) + db.session.commit() + db.session.refresh(conversation) return conversation