mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix: correctly update parser method & correct vllm pdf parser (#10441)
### What problem does this PR solve? Fix: correctly update parser method ### Type of change - [X] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -557,8 +557,8 @@ def get(doc_id):
|
|||||||
@login_required
|
@login_required
|
||||||
@validate_request("doc_id")
|
@validate_request("doc_id")
|
||||||
def change_parser():
|
def change_parser():
|
||||||
req = request.json
|
|
||||||
|
|
||||||
|
req = request.json
|
||||||
if not DocumentService.accessible(req["doc_id"], current_user.id):
|
if not DocumentService.accessible(req["doc_id"], current_user.id):
|
||||||
return get_json_result(data=False, message="No authorization.", code=settings.RetCode.AUTHENTICATION_ERROR)
|
return get_json_result(data=False, message="No authorization.", code=settings.RetCode.AUTHENTICATION_ERROR)
|
||||||
|
|
||||||
@ -582,7 +582,7 @@ def change_parser():
|
|||||||
settings.docStoreConn.delete({"doc_id": doc.id}, search.index_name(tenant_id), doc.kb_id)
|
settings.docStoreConn.delete({"doc_id": doc.id}, search.index_name(tenant_id), doc.kb_id)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if "pipeline_id" in req:
|
if "pipeline_id" in req and req["pipeline_id"] != "":
|
||||||
if doc.pipeline_id == req["pipeline_id"]:
|
if doc.pipeline_id == req["pipeline_id"]:
|
||||||
return get_json_result(data=True)
|
return get_json_result(data=True)
|
||||||
DocumentService.update_by_id(doc.id, {"pipeline_id": req["pipeline_id"]})
|
DocumentService.update_by_id(doc.id, {"pipeline_id": req["pipeline_id"]})
|
||||||
|
|||||||
@ -1274,12 +1274,16 @@ class VisionParser(RAGFlowPdfParser):
|
|||||||
prompt=vision_llm_describe_prompt(page=pdf_page_num + 1),
|
prompt=vision_llm_describe_prompt(page=pdf_page_num + 1),
|
||||||
callback=callback,
|
callback=callback,
|
||||||
)
|
)
|
||||||
|
|
||||||
if kwargs.get("callback"):
|
if kwargs.get("callback"):
|
||||||
kwargs["callback"](idx * 1.0 / len(self.page_images), f"Processed: {idx + 1}/{len(self.page_images)}")
|
kwargs["callback"](idx * 1.0 / len(self.page_images), f"Processed: {idx + 1}/{len(self.page_images)}")
|
||||||
|
|
||||||
if text:
|
if text:
|
||||||
width, height = self.page_images[idx].size
|
width, height = self.page_images[idx].size
|
||||||
all_docs.append((text, f"{pdf_page_num + 1} 0 {width / zoomin} 0 {height / zoomin}"))
|
all_docs.append((
|
||||||
|
text,
|
||||||
|
f"@@{pdf_page_num + 1}\t{0.0:.1f}\t{width / zoomin:.1f}\t{0.0:.1f}\t{height / zoomin:.1f}##"
|
||||||
|
))
|
||||||
return all_docs, []
|
return all_docs, []
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user