mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-17 05:07:23 +08:00
## What this PR does Removes the self-concatenation of the vision model response in the video parsing path, so each generated video description is tokenized and indexed exactly once. A focused regression test exercises the public `picture.chunk` video path with a mocked vision model and asserts that the returned description is passed to `tokenize` once without duplication. ## Root cause The original video parsing implementation used: ```python ans += "\n" + ans tokenize(doc, ans, ...) ``` This duplicates the same model response. The adjacent image path combines two distinct values (`OCR text + vision description`); the video path has only the model response, so concatenating it with itself is an unintended copy/paste error from that image logic. ## Impact Before this fix, every successfully parsed video stored repeated text, increasing token and embedding input and potentially distorting indexed chunk content and retrieval scoring. ## Compatibility The change affects only the video branch in `rag/app/picture.py`. Image parsing, model invocation, prompts, callbacks, and error handling remain unchanged. ## Validation - `pytest --confcutdir=test/unit_test/rag/app test/unit_test/rag/app/test_picture_video.py -q`: 1 passed - Ruff check: passed - Ruff format check for the new test: passed - `git diff --check`: passed Closes #16846. --------- Co-authored-by: openhands <openhands@all-hands.dev>