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: first message query error (#21444)

jiangbo7219de552cb4268
diff --git a/api/models/model.py b/api/models/model.py
index 75202d93676..c980e61bafe 100644
--- a/api/models/model.py
+++ b/api/models/model.py
@@ -832,7 +832,12 @@ class Conversation(Base):
@property
def first_message(self):
- return db.session.query(Message).filter(Message.conversation_id == self.id).first()
+ return (
+ db.session.query(Message)
+ .filter(Message.conversation_id == self.id)
+ .order_by(Message.created_at.asc())
+ .first()
+ )
@property
def app(self):