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:
buua436
2026-05-06 20:33:08 +08:00
committed by GitHub
parent faae91d34f
commit 3e396c0a72

View File

@@ -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