diff --git a/agent/component/docs_generator.py b/agent/component/docs_generator.py index d51b0ea591..b0c1b313af 100644 --- a/agent/component/docs_generator.py +++ b/agent/component/docs_generator.py @@ -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