mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 15:31:05 +08:00
Fix: add base64 to doc generator output (#14599)
### What problem does this PR solve? add base64 to doc generator output ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import base64
|
||||
import logging
|
||||
import json
|
||||
import os
|
||||
@@ -113,6 +114,7 @@ class DocGenerator(Message, ABC):
|
||||
raise Exception("Document file is empty")
|
||||
|
||||
file_size = len(file_bytes)
|
||||
file_base64 = base64.b64encode(file_bytes).decode("utf-8")
|
||||
doc_id = get_uuid()
|
||||
settings.STORAGE_IMPL.put(self._canvas.get_tenant_id(), doc_id, file_bytes)
|
||||
|
||||
@@ -128,6 +130,7 @@ class DocGenerator(Message, ABC):
|
||||
"filename": filename,
|
||||
"mime_type": mime_type,
|
||||
"size": file_size,
|
||||
"base64": file_base64,
|
||||
}
|
||||
self.set_output("download", json.dumps(download_info))
|
||||
return download_info
|
||||
|
||||
Reference in New Issue
Block a user