Skip to content

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

Feat: Expose Doc Generator file metadata as discrete outputs (#15080)

nickmopene7d45dd6453c
diff --git a/agent/component/docs_generator.py b/agent/component/docs_generator.py
index ce7a3abad5..2809a9b1ca 100644
--- a/agent/component/docs_generator.py
+++ b/agent/component/docs_generator.py
@@ -52,6 +52,10 @@ class DocGeneratorParam(ComponentParamBase):
self.include_download_info_in_content = False
self.font_size = 12
self.outputs = {
+ "doc_id": {"value": "", "type": "string"},
+ "filename": {"value": "", "type": "string"},
+ "mime_type": {"value": "", "type": "string"},
+ "size": {"value": 0, "type": "number"},
"download": {"value": "", "type": "string"},
}
@@ -134,6 +138,10 @@ class DocGenerator(Message, ABC):
"base64": file_base64,
"include_download_info_in_content": self._param.include_download_info_in_content,
}
+ self.set_output("doc_id", doc_id)
+ self.set_output("filename", filename)
+ self.set_output("mime_type", mime_type)
+ self.set_output("size", file_size)
self.set_output("download", json.dumps(download_info))
return download_info
diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx
index 1c02500706..fa169a526a 100644
--- a/web/src/pages/agent/constant/index.tsx
+++ b/web/src/pages/agent/constant/index.tsx
@@ -978,6 +978,10 @@ export const initialDocGeneratorValues = {
include_download_info_in_content: false,
font_size: 12,
outputs: {
+ doc_id: { type: 'string' },
+ filename: { type: 'string' },
+ mime_type: { type: 'string' },
+ size: { type: 'number' },
download: { type: 'string' },
},
};
diff --git a/web/src/pages/agent/form/doc-generator-form/index.tsx b/web/src/pages/agent/form/doc-generator-form/index.tsx
index 56faf96535..7ec137f6ec 100644
--- a/web/src/pages/agent/form/doc-generator-form/index.tsx
+++ b/web/src/pages/agent/form/doc-generator-form/index.tsx
@@ -38,6 +38,10 @@ function DocGeneratorForm({ node }: INextOperatorForm) {
include_download_info_in_content: z.boolean(),
font_size: z.coerce.number().min(12, 'Font size must be at least 12'),
outputs: z.object({
+ doc_id: z.object({ type: z.string() }),
+ filename: z.object({ type: z.string() }),
+ mime_type: z.object({ type: z.string() }),
+ size: z.object({ type: z.string() }),
download: z.object({ type: z.string() }),
}),
});