mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 09:49:25 +08:00
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:
committed by
GitHub
parent
beda78e911
commit
09ee8ea1f5
@@ -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"
|
||||
Reference in New Issue
Block a user