Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

439 B
Raw Blame
export type HistoryPageAttempt =
  | { status: 'failed' }
  | {
      status: 'loaded'
      itemCount: number
      pageSize: number
      cursorAdvanced: boolean
    }

export function historyHasMoreAfterAttempt(
  previousHasMore: boolean,
  attempt: HistoryPageAttempt,
): boolean {
  if (attempt.status === 'failed') return previousHasMore
  return previousHasMore && attempt.cursorAdvanced && attempt.itemCount >= attempt.pageSize
}