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: correct has_more pagination logic in get_conversational_variable (#25484)

Yongtao Huanga1322ddb5d6e
diff --git a/api/services/conversation_service.py b/api/services/conversation_service.py
index d017ce54ab1..a29204aabf7 100644
--- a/api/services/conversation_service.py
+++ b/api/services/conversation_service.py
@@ -222,8 +222,8 @@ class ConversationService:
# Filter for variables created after the last_id
stmt = stmt.where(ConversationVariable.created_at > last_variable.created_at)
- # Apply limit to query
- query_stmt = stmt.limit(limit) # Get one extra to check if there are more
+ # Apply limit to query: fetch one extra row to determine has_more
+ query_stmt = stmt.limit(limit + 1)
rows = session.scalars(query_stmt).all()
has_more = False