From a1322ddb5d6e603b9e6b74f84d945d30d97aac3b Mon Sep 17 00:00:00 2001 From: Yongtao Huang Date: Fri, 12 Sep 2025 09:32:22 +0800 Subject: [PATCH] Fix: correct has_more pagination logic in get_conversational_variable (#25484) Signed-off-by: Yongtao Huang --- api/services/conversation_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/services/conversation_service.py b/api/services/conversation_service.py index d017ce54ab..a29204aabf 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