Skip to main content

construct/memory/
chunker.rs

1//! Markdown chunker — stub (removed in Construct).
2//!
3//! The chunker was used by the Qdrant embedding flow and RAG ingestion.
4//! Persistent memory is now handled via Kumiho MCP.
5//! A minimal `chunk_markdown` is retained for callers in `rag/mod.rs`.
6
7/// A single chunk of text with metadata.
8#[derive(Debug, Clone)]
9pub struct Chunk {
10    pub index: usize,
11    pub content: String,
12    pub heading: Option<std::rc::Rc<str>>,
13}
14
15/// Split markdown text into chunks — simplified stub.
16///
17/// Returns the entire text as a single chunk (no splitting).
18/// For real chunking, use Kumiho MCP's server-side processing.
19pub fn chunk_markdown(text: &str, _max_tokens: usize) -> Vec<Chunk> {
20    let trimmed = text.trim();
21    if trimmed.is_empty() {
22        return Vec::new();
23    }
24
25    vec![Chunk {
26        index: 0,
27        content: trimmed.to_string(),
28        heading: None,
29    }]
30}