Skip to content

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

Fix RGBA error (#3707)

kuschzzpe678819f7066
diff --git a/rag/app/picture.py b/rag/app/picture.py
index 8d5df5219a..fb9b1e2695 100644
--- a/rag/app/picture.py
+++ b/rag/app/picture.py
@@ -41,7 +41,10 @@ def chunk(filename, binary, tenant_id, lang, callback=None, **kwargs):
try:
callback(0.4, "Use CV LLM to describe the picture.")
cv_mdl = LLMBundle(tenant_id, LLMType.IMAGE2TEXT, lang=lang)
- ans = cv_mdl.describe(binary)
+ img_binary = io.BytesIO()
+ img.save(img_binary, format='JPEG')
+ img_binary.seek(0)
+ ans = cv_mdl.describe(img_binary.read())
callback(0.8, "CV LLM respond: %s ..." % ans[:32])
txt += "\n" + ans
tokenize(doc, txt, eng)