mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
Marking the last piece of data on each page is a duplicate issue, which can be solved by adding the id field to the order by rig and using a unique field (#9799)
Signed-off-by: root <root@localhost.localdomain> Co-authored-by: root <root@localhost.localdomain>
This commit is contained in:
parent
60ddcdf960
commit
4693080ce0
|
@ -132,14 +132,14 @@ class AppAnnotationService:
|
|||
MessageAnnotation.content.ilike("%{}%".format(keyword)),
|
||||
)
|
||||
)
|
||||
.order_by(MessageAnnotation.created_at.desc())
|
||||
.order_by(MessageAnnotation.created_at.desc(), MessageAnnotation.id.desc())
|
||||
.paginate(page=page, per_page=limit, max_per_page=100, error_out=False)
|
||||
)
|
||||
else:
|
||||
annotations = (
|
||||
db.session.query(MessageAnnotation)
|
||||
.filter(MessageAnnotation.app_id == app_id)
|
||||
.order_by(MessageAnnotation.created_at.desc())
|
||||
.order_by(MessageAnnotation.created_at.desc(), MessageAnnotation.id.desc())
|
||||
.paginate(page=page, per_page=limit, max_per_page=100, error_out=False)
|
||||
)
|
||||
return annotations.items, annotations.total
|
||||
|
|
Loading…
Reference in New Issue
Block a user