mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-08 12:24:48 +08:00
Fix: support vlm fall back in pipeline (#14007)
### What problem does this PR solve? Fix: support vlm fall back in pipeline for img/table parsing ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -625,15 +625,12 @@ class Parser(ProcessBase):
|
||||
if abstract_idx is not None:
|
||||
bboxes[abstract_idx]["abstract"] = True
|
||||
|
||||
print(conf.get("vlm"))
|
||||
|
||||
if conf.get("vlm"):
|
||||
enhance_media_sections_with_vision(
|
||||
bboxes,
|
||||
self._canvas._tenant_id,
|
||||
conf["vlm"],
|
||||
callback=self.callback,
|
||||
)
|
||||
enhance_media_sections_with_vision(
|
||||
bboxes,
|
||||
self._canvas._tenant_id,
|
||||
conf.get("vlm"),
|
||||
callback=self.callback,
|
||||
)
|
||||
|
||||
# Emit the requested final PDF output format.
|
||||
if conf.get("output_format") == "json":
|
||||
@@ -804,13 +801,12 @@ class Parser(ProcessBase):
|
||||
"doc_type_kwd": "table",
|
||||
}
|
||||
)
|
||||
if conf.get("vlm"):
|
||||
enhance_media_sections_with_vision(
|
||||
sections,
|
||||
self._canvas._tenant_id,
|
||||
conf["vlm"],
|
||||
callback=self.callback,
|
||||
)
|
||||
enhance_media_sections_with_vision(
|
||||
sections,
|
||||
self._canvas._tenant_id,
|
||||
conf.get("vlm"),
|
||||
callback=self.callback,
|
||||
)
|
||||
|
||||
self.set_output("json", sections)
|
||||
|
||||
@@ -930,13 +926,12 @@ class Parser(ProcessBase):
|
||||
json_result["doc_type_kwd"] = "image" if json_result.get("image") is not None else "text"
|
||||
json_results.append(json_result)
|
||||
|
||||
if conf.get("vlm"):
|
||||
enhance_media_sections_with_vision(
|
||||
json_results,
|
||||
self._canvas._tenant_id,
|
||||
conf["vlm"],
|
||||
callback=self.callback,
|
||||
)
|
||||
enhance_media_sections_with_vision(
|
||||
json_results,
|
||||
self._canvas._tenant_id,
|
||||
conf.get("vlm"),
|
||||
callback=self.callback,
|
||||
)
|
||||
self.set_output("json", json_results)
|
||||
else:
|
||||
self.set_output("text", "\n".join([section_text for section_text, _ in sections]))
|
||||
|
||||
@@ -125,7 +125,7 @@ def enhance_media_sections_with_vision(
|
||||
vlm_conf=None,
|
||||
callback=None,
|
||||
):
|
||||
if not sections or not tenant_id or not vlm_conf:
|
||||
if not sections or not tenant_id:
|
||||
return sections
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user