Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Infiniflow Ragflow Document Util

From Leeroopedia
Knowledge Sources
Domains Frontend, Document_Processing
Last Updated 2026-02-12 06:00 GMT

Overview

Concrete utility functions for document and chunk handling including chunk highlight building in the RAGFlow frontend.

Description

The utils/document-util.ts module provides functions for building PDF highlight annotations from chunk position data, formatting chunk display text, and computing chunk-to-page mappings for document viewer integration.

Usage

Import these utilities in document viewer and chunk display components where chunk positions need to be rendered as highlights on PDF pages.

Code Reference

Source Location

Signature

export function buildChunkHighlights(positions: number[][]): HighlightArea[];
export function getChunkPageNumbers(positions: number[][]): number[];

Import

import { buildChunkHighlights } from '@/utils/document-util';

I/O Contract

Inputs

Name Type Required Description
positions number[][] Yes Chunk position coordinates array

Outputs

Name Type Description
buildChunkHighlights() HighlightArea[] PDF highlight annotation areas

Usage Examples

import { buildChunkHighlights } from '@/utils/document-util';

const highlights = buildChunkHighlights(chunk.positions);
// Pass to PDF viewer component for rendering

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment