Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: Use raw SQL UPDATE to set read status without triggering updated… (#31015)

wangxiaolei5008f5e89bcb
diff --git a/api/controllers/console/app/conversation.py b/api/controllers/console/app/conversation.py
index 56816dd4625..55fdcb51e42 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