mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-03 00:55:10 +08:00
Fix: image not displaying thumbnails when using pipeline (#12574)
### What problem does this PR solve? Fix image not displaying thumbnails when using pipeline. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -61,7 +61,7 @@ class ParserParam(ProcessParamBase):
|
|||||||
"json",
|
"json",
|
||||||
],
|
],
|
||||||
"image": [
|
"image": [
|
||||||
"text",
|
"json",
|
||||||
],
|
],
|
||||||
"email": [
|
"email": [
|
||||||
"text",
|
"text",
|
||||||
@ -120,7 +120,7 @@ class ParserParam(ProcessParamBase):
|
|||||||
"lang": "Chinese",
|
"lang": "Chinese",
|
||||||
"system_prompt": "",
|
"system_prompt": "",
|
||||||
"suffix": ["jpg", "jpeg", "png", "gif"],
|
"suffix": ["jpg", "jpeg", "png", "gif"],
|
||||||
"output_format": "text",
|
"output_format": "json",
|
||||||
},
|
},
|
||||||
"email": {
|
"email": {
|
||||||
"suffix": [
|
"suffix": [
|
||||||
@ -642,7 +642,12 @@ class Parser(ProcessBase):
|
|||||||
else:
|
else:
|
||||||
txt = cv_model.describe(img_binary.read())
|
txt = cv_model.describe(img_binary.read())
|
||||||
|
|
||||||
self.set_output("text", txt)
|
json_result = [{
|
||||||
|
"text": txt,
|
||||||
|
"image": img,
|
||||||
|
"doc_type_kwd": "image",
|
||||||
|
}]
|
||||||
|
self.set_output("json", json_result)
|
||||||
|
|
||||||
def _audio(self, name, blob):
|
def _audio(self, name, blob):
|
||||||
import os
|
import os
|
||||||
|
|||||||
@ -300,6 +300,11 @@ async def build_chunks(task, progress_callback):
|
|||||||
(chunk["content_with_weight"] + str(d["doc_id"])).encode("utf-8", "surrogatepass")).hexdigest()
|
(chunk["content_with_weight"] + str(d["doc_id"])).encode("utf-8", "surrogatepass")).hexdigest()
|
||||||
d["create_time"] = str(datetime.now()).replace("T", " ")[:19]
|
d["create_time"] = str(datetime.now()).replace("T", " ")[:19]
|
||||||
d["create_timestamp_flt"] = datetime.now().timestamp()
|
d["create_timestamp_flt"] = datetime.now().timestamp()
|
||||||
|
|
||||||
|
if d.get("img_id"):
|
||||||
|
docs.append(d)
|
||||||
|
return
|
||||||
|
|
||||||
if not d.get("image"):
|
if not d.get("image"):
|
||||||
_ = d.pop("image", None)
|
_ = d.pop("image", None)
|
||||||
d["img_id"] = ""
|
d["img_id"] = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user