Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Trivals. (#8597)

Kevin Hue3edcc306491
diff --git a/api/utils/log_utils.py b/api/utils/log_utils.py
index 3ebedd1482..0a4840e79a 100644
--- a/api/utils/log_utils.py
+++ b/api/utils/log_utils.py
@@ -83,5 +83,9 @@ def init_root_logger(logfile_basename: str, log_format: str = "%(asctime)-15s %(
def log_exception(e, *args):
logging.exception(e)
for a in args:
- logging.error(str(a))
+ if hasattr(a, "text"):
+ logging.error(a.text)
+ raise Exception(a.text)
+ else:
+ logging.error(str(a))
raise e
\ No newline at end of file
diff --git a/graphrag/general/index.py b/graphrag/general/index.py
index 8c98636791..6e107bc87a 100644
--- a/graphrag/general/index.py
+++ b/graphrag/general/index.py
@@ -57,7 +57,7 @@ async def run_graphrag(
subgraph = await generate_subgraph(
LightKGExt
- if "method" not in row["kb_parser_config"]["graphrag"] or row["kb_parser_config"]["graphrag"]["method"] != "general"
+ if "method" not in row["kb_parser_config"].get("graphrag", {}) or row["kb_parser_config"]["graphrag"]["method"] != "general"
else GeneralKGExt,
tenant_id,
kb_id,
diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py
index ae5f548f9f..a5dfafecab 100644
--- a/rag/svr/task_executor.py
+++ b/rag/svr/task_executor.py
@@ -300,11 +300,12 @@ async def build_chunks(task, progress_callback):
d["image"].close() # Close original image
d["image"] = converted_image
d["image"].save(output_buffer, format='JPEG')
- d["image"].close() # Close PIL image after saving
async with minio_limiter:
await trio.to_thread.run_sync(lambda: STORAGE_IMPL.put(task["kb_id"], d["id"], output_buffer.getvalue()))
d["img_id"] = "{}-{}".format(task["kb_id"], d["id"])
+ if not isinstance(d["image"], bytes):
+ d["image"].close()
del d["image"] # Remove image reference
docs.append(d)
finally: