fix: support qa_preview shape in IndexProcessor preview formatting (#34151)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
Full Stack Engineer
2026-04-01 00:22:23 -04:00
committed by GitHub
parent beda78e911
commit 09ee8ea1f5
2 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
from core.rag.index_processor.index_processor import IndexProcessor
class TestIndexProcessor:
def test_format_preview_supports_qa_preview_shape(self) -> None:
preview = IndexProcessor().format_preview(
"qa_model",
{"qa_chunks": [{"question": "Q1", "answer": "A1"}]},
)
assert preview.chunk_structure == "qa_model"
assert preview.total_segments == 1
assert len(preview.qa_preview) == 1
assert preview.qa_preview[0].question == "Q1"
assert preview.qa_preview[0].answer == "A1"