Feat: Add knowledge compilation workflows (#16515)

## Summary
- Add knowledge compilation template APIs, services, and builtin
template seed data
- Add advanced knowledge compile structure/artifact/RAPTOR workflow
support
- Update parsing, dataset/document APIs, and supporting services for
compilation workflows
This commit is contained in:
Kevin Hu
2026-07-02 23:22:07 +08:00
committed by GitHub
parent 7d64a78f83
commit 62f94cd59b
57 changed files with 14587 additions and 3094 deletions

View File

@@ -701,11 +701,11 @@ class RAGFlowPdfParser:
logging.info(f"Added {added} OCR results from rotated table {table_index}")
def __ocr(self, pagenum, img, chars, ZM=3, device_id: int | None = None):
start = timer()
# start = timer()
bxs = self.ocr.detect(np.array(img), device_id)
logging.info(f"__ocr detecting boxes of an image cost ({timer() - start}s)")
# logging.info(f"__ocr detecting boxes of an image cost ({timer() - start}s)")
start = timer()
# start = timer()
if not bxs:
self.boxes.append([])
return
@@ -771,8 +771,8 @@ class RAGFlowPdfParser:
)
b["text"] = ""
logging.info(f"__ocr sorting {len(chars)} chars cost {timer() - start}s")
start = timer()
# logging.info(f"__ocr sorting {len(chars)} chars cost {timer() - start}s")
# start = timer()
boxes_to_reg = []
img_np = None
for b in bxs:
@@ -787,7 +787,7 @@ class RAGFlowPdfParser:
for i in range(len(boxes_to_reg)):
boxes_to_reg[i]["text"] = texts[i]
del boxes_to_reg[i]["box_image"]
logging.info(f"__ocr recognize {len(bxs)} boxes cost {timer() - start}s")
# logging.info(f"__ocr recognize {len(bxs)} boxes cost {timer() - start}s")
bxs = [b for b in bxs if b["text"]]
if self.mean_height[pagenum - 1] == 0:
self.mean_height[pagenum - 1] = np.median([b["bottom"] - b["top"] for b in bxs])