RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Refactor: Improve the buffer close for vision_llm_chunk (#9845)
Stephen Hu0b456a18a3e0
diff --git a/rag/app/picture.py b/rag/app/picture.pyindex db9bb37293..a868cf4cca 100644--- a/rag/app/picture.py+++ b/rag/app/picture.py@@ -78,15 +78,12 @@ def vision_llm_chunk(binary, vision_model, prompt=None, callback=None):txt = ""try:- img_binary = io.BytesIO()- img.save(img_binary, format='JPEG')- img_binary.seek(0)-- ans = clean_markdown_block(vision_model.describe_with_prompt(img_binary.read(), prompt))-- txt += "\n" + ans-- return txt+ with io.BytesIO() as img_binary:+ img.save(img_binary, format='JPEG')+ img_binary.seek(0)+ ans = clean_markdown_block(vision_model.describe_with_prompt(img_binary.read(), prompt))+ txt += "\n" + ans+ return txtexcept Exception as e:callback(-1, str(e))