-
fix: avoid duplicating video descriptions during parsing (#16847)
发布于
2026-07-16 01:41:18 +00: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.chunkvideo
path with a mocked vision model and asserts that the returned
description is passed totokenizeonce without duplication.Root cause
The original video parsing implementation used:
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
下载附件