feat: make the SegmentService.get_segments sort stable (#30152)

This commit is contained in:
wangxiaolei
2025-12-25 15:53:38 +08:00
committed by GitHub
parent 5549ab66ff
commit d1f9911848
2 changed files with 473 additions and 1 deletions
+1 -1
View File
@@ -3458,7 +3458,7 @@ class SegmentService:
if keyword:
query = query.where(DocumentSegment.content.ilike(f"%{keyword}%"))
query = query.order_by(DocumentSegment.position.asc())
query = query.order_by(DocumentSegment.position.asc(), DocumentSegment.id.asc())
paginated_segments = db.paginate(select=query, page=page, per_page=limit, max_per_page=100, error_out=False)
return paginated_segments.items, paginated_segments.total