Files
jubaoliangandCursor e8a824bb1e feat(knowledge): add knowledge bases with chat retrieval
Introduce document indexing, embedding (ONNX/remote), and chat/IM injection with default-open selection in the dashboard composer.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-12 18:56:23 +08:00

20 lines
540 B
Python

"""Unit tests for document chunking."""
from __future__ import annotations
import pytest
from octop.infra.knowledge.chunk import chunk_text
def test_chunk_text_preserves_content_with_configured_overlap() -> None:
chunks = chunk_text("abcdefghij", size=4, overlap=1)
assert chunks == ["abcd", "defg", "ghij"]
def test_chunk_text_strips_empty_content_and_rejects_invalid_window() -> None:
assert chunk_text(" \n\t ") == []
with pytest.raises(ValueError, match="overlap"):
chunk_text("text", size=4, overlap=4)