Skip to content

Pagination not working for AgentFlow in /api/v1/chatmessage endpoint #6297

@JacksonMilhomens

Description

@JacksonMilhomens

Describe the bug

The GET /api/v1/chatmessage/:id endpoint does not respect the limit and page query parameters when the chatflow is of type AgentFlow. Regardless of the values sent, the API returns the full set of messages for the given period in every response, causing data duplication when iterating over pages.
The same request works correctly for Chatflow type chatflows, where pagination behaves as expected.

To Reproduce

  1. Create an AgentFlow chatflow and generate some messages
  2. Fetch total message count via GET /api/v1/stats/:id with a startDate and endDate
  3. Calculate total pages: totalPages = Math.ceil(totalMessages / limit)
  4. Request page 1: GET /api/v1/chatmessage/:id?startDate=...&endDate=...&order=ASC&page=1&limit=100
  5. Request page 2: GET /api/v1/chatmessage/:id?...&page=2&limit=100
  6. Observe that both responses return the same full dataset (e.g. 138 messages on both pages)

Expected behavior

The endpoint should respect limit and page for AgentFlow chatflows, consistent with how it already behaves for Chatflow chatflows.

Screenshots

No response

Flow

No response

Use Method

Docker

Flowise Version

3.1.1

Operating System

Windows

Browser

Chrome

Additional context

Tested with a Chatflow chatflow using the same parameters — pagination works correctly
The issue appears to be isolated to AgentFlow type chatflows
Workaround: remove pagination and fetch all messages in a single request (acceptable for low message volumes, but not scalable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions