How to handle Open Ai Assistant Pagination. Right now if we use hasNextPage() we always receive true even with created new thread.
let messages = await openai.beta.threads.messages.list(
threadId,
{
order: "desc",
limit: 100,
after: paginatedParams?.after || ''
}
);
// const has_more = messages.hasNextPage();
const has_more = messages.hasNextPage();
const nextPageParams = messages.nextPageParams()
const nextPageItems = messages.getPaginatedItems()
With new created thread, always receive getPaginatedItems(). One message with role user and one for assistant.