Skip to content

bugfix: fix chatmessage pagination for standard queries#6301

Open
AnwarRezk wants to merge 5 commits intoFlowiseAI:mainfrom
AnwarRezk:fix-chatmessage-pagination
Open

bugfix: fix chatmessage pagination for standard queries#6301
AnwarRezk wants to merge 5 commits intoFlowiseAI:mainfrom
AnwarRezk:fix-chatmessage-pagination

Conversation

@AnwarRezk
Copy link
Copy Markdown

Summary

  • apply page and limit to the default GET /api/v1/chatmessage/:id query path
  • add regression coverage for paginated and unpaginated chat message retrieval
  • fix the case where paginated requests could return the full dataset instead of the requested page

Problem

GET /api/v1/chatmessage/:id was already accepting pagination parameters, but the standard ChatMessage.find(...) path in utilGetChatMessage did not apply them.
As a result, requests such as:
/api/v1/chatmessage/:id?page=2&limit=100
could return the same full message set as page 1 instead of the requested slice.

Root Cause

In packages/server/src/utils/getChatMessage.ts, the non-feedback query path passed filters and ordering to TypeORM, but did not set skip/take.

Fix

  • add skip and take to the default query when both page and pageSize are valid
  • leave unpaginated behavior unchanged when pagination is not requested

Testing

  • added packages/server/src/utils/getChatMessage.test.ts
  • verified:
    • paginated queries apply skip and take
    • unpaginated queries leave them unset

Related Issues

AnwarRezk and others added 2 commits April 28, 2026 01:31
Apply page and limit to the default chat message query path so paginated requests no longer return the full dataset. Add regression coverage for paginated and unpaginated retrieval.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements pagination for the utilGetChatMessage function by adding skip and take parameters to the database query. It also includes unit tests to verify that pagination is correctly applied when page and pageSize are provided and ignored when they are not. I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GET /api/v1/chatmessage ignores limit and page parameters for AgentFlow chatflows

1 participant