Skip to content

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

fix(agent): remove obsolete download info toggle (#20588)

Sbaaoui Idriss65380245658c
diff --git a/internal/agent/component/docs_generator.go b/internal/agent/component/docs_generator.go
index a9d4f79007..25d13414d7 100644
--- a/internal/agent/component/docs_generator.go
+++ b/internal/agent/component/docs_generator.go
@@ -79,16 +79,15 @@ var validOutputFormats = map[string]bool{
// docsGeneratorParam is the static DSL param surface.
type docsGeneratorParam struct {
- OutputFormat string `json:"output_format"`
- Content string `json:"content"`
- Filename string `json:"filename"`
- HeaderText string `json:"header_text"`
- FooterText string `json:"footer_text"`
- WatermarkText string `json:"watermark_text"`
- AddPageNumbers bool `json:"add_page_numbers"`
- AddTimestamp bool `json:"add_timestamp"`
- FontSize int `json:"font_size"`
- IncludeDownloadInfoInContent bool `json:"include_download_info_in_content"`
+ OutputFormat string `json:"output_format"`
+ Content string `json:"content"`
+ Filename string `json:"filename"`
+ HeaderText string `json:"header_text"`
+ FooterText string `json:"footer_text"`
+ WatermarkText string `json:"watermark_text"`
+ AddPageNumbers bool `json:"add_page_numbers"`
+ AddTimestamp bool `json:"add_timestamp"`
+ FontSize int `json:"font_size"`
}
// Update copies a fresh params map into the receiver.
@@ -135,9 +134,6 @@ func (p *docsGeneratorParam) Update(conf map[string]any) error {
} else {
p.FontSize = defaultDocsFontSize
}
- if v, ok := boolFrom(conf, "include_download_info_in_content"); ok {
- p.IncludeDownloadInfoInContent = v
- }
return nil
}
@@ -162,16 +158,15 @@ func (p *docsGeneratorParam) Check() error {
// AsDict returns the param as a plain map.
func (p *docsGeneratorParam) AsDict() map[string]any {
return map[string]any{
- "output_format": p.OutputFormat,
- "content": p.Content,
- "filename": p.Filename,
- "header_text": p.HeaderText,
- "footer_text": p.FooterText,
- "watermark_text": p.WatermarkText,
- "add_page_numbers": p.AddPageNumbers,
- "add_timestamp": p.AddTimestamp,
- "font_size": p.FontSize,
- "include_download_info_in_content": p.IncludeDownloadInfoInContent,
+ "output_format": p.OutputFormat,
+ "content": p.Content,
+ "filename": p.Filename,
+ "header_text": p.HeaderText,
+ "footer_text": p.FooterText,
+ "watermark_text": p.WatermarkText,
+ "add_page_numbers": p.AddPageNumbers,
+ "add_timestamp": p.AddTimestamp,
+ "font_size": p.FontSize,
}
}
@@ -307,14 +302,13 @@ func (d *DocsGenerator) Invoke(ctx context.Context, db *gorm.DB, inputs map[stri
previewURL := utility.AgentAttachmentPreviewPath(docID, extWithoutDot, mime)
downloadURL := agentAttachmentDownloadPath(docID, extWithoutDot, mime, safeName)
downloadInfo := map[string]any{
- "doc_id": docID,
- "filename": safeName,
- "mime_type": mime,
- "size": size,
- "url": downloadURL,
- "download": downloadURL,
- "preview_url": previewURL,
- "include_download_info_in_content": param.IncludeDownloadInfoInContent,
+ "doc_id": docID,
+ "filename": safeName,
+ "mime_type": mime,
+ "size": size,
+ "url": downloadURL,
+ "download": downloadURL,
+ "preview_url": previewURL,
}
downloadJSON, err := json.Marshal(downloadInfo)
if err != nil {
@@ -322,17 +316,16 @@ func (d *DocsGenerator) Invoke(ctx context.Context, db *gorm.DB, inputs map[stri
}
return map[string]any{
- "doc_id": docID,
- "filename": safeName,
- "mime_type": mime,
- "size": size,
- "bytes": payload,
- "download": string(downloadJSON),
- "download_info": downloadInfo,
- "preview_url": previewURL,
- "stored": stored,
- "include_download_info_in_content": param.IncludeDownloadInfoInContent,
- "created": time.Now().UTC().Format(time.RFC3339),
+ "doc_id": docID,
+ "filename": safeName,
+ "mime_type": mime,
+ "size": size,
+ "bytes": payload,
+ "download": string(downloadJSON),
+ "download_info": downloadInfo,
+ "preview_url": previewURL,
+ "stored": stored,
+ "created": time.Now().UTC().Format(time.RFC3339),
}, nil
}
diff --git a/internal/agent/component/message_phase8b_test.go b/internal/agent/component/message_phase8b_test.go
index bdf5a055b2..121b9d0bbb 100644
--- a/internal/agent/component/message_phase8b_test.go
+++ b/internal/agent/component/message_phase8b_test.go
@@ -125,7 +125,7 @@ func TestMessage_DownloadJSONStringSuppressesContent(t *testing.T) {
c, _ := NewMessageComponent(map[string]any{"text": "unused"})
state := canvas.NewCanvasState("r1", "t1")
ctx := withStateForTest(t.Context(), state)
- downloadJSON := `{"doc_id":"d-1","filename":"report.md","mime_type":"text/markdown","url":"/api/v1/agents/attachments/d-1/download","include_download_info_in_content":true}`
+ downloadJSON := `{"doc_id":"d-1","filename":"report.md","mime_type":"text/markdown","url":"/api/v1/agents/attachments/d-1/download"}`
out, err := c.Invoke(ctx, nil, map[string]any{
"text": downloadJSON,
diff --git a/internal/agent/component/render.go b/internal/agent/component/render.go
index e07f2b9b36..0b9094ac3e 100644
--- a/internal/agent/component/render.go
+++ b/internal/agent/component/render.go
@@ -65,14 +65,13 @@ const (
// entry. Mirrors agent/component/message.py:_is_download_info
// (the {doc_id, filename, mime_type} tuple).
type DownloadInfo struct {
- DocID string `json:"doc_id"`
- Filename string `json:"filename"`
- MimeType string `json:"mime_type"`
- URL string `json:"url,omitempty"`
- Content string `json:"content,omitempty"`
- Size int `json:"size,omitempty"`
- PreviewURL string `json:"preview_url,omitempty"`
- IncludeDownloadInfoInContent bool `json:"include_download_info_in_content,omitempty"`
+ DocID string `json:"doc_id"`
+ Filename string `json:"filename"`
+ MimeType string `json:"mime_type"`
+ URL string `json:"url,omitempty"`
+ Content string `json:"content,omitempty"`
+ Size int `json:"size,omitempty"`
+ PreviewURL string `json:"preview_url,omitempty"`
}
// RenderRequest is the renderer input. Text is the resolved
@@ -325,8 +324,5 @@ func downloadFromMap(m map[string]any) DownloadInfo {
} else if i, ok := m["size"].(int); ok {
d.Size = i
}
- if b, ok := m["include_download_info_in_content"].(bool); ok {
- d.IncludeDownloadInfoInContent = b
- }
return d
}
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index 3db8905994..f65ba81822 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -2966,7 +2966,6 @@ Best for: Documents with flowing, contextually connected content — such as boo
watermarkText: 'Watermark Text',
headerText: 'Header Text',
footerText: 'Footer Text',
- includeDownloadInfoInContent: 'Append download info to content',
contentPlaceholder: 'Enter markdown content...',
filenamePlaceholder: 'document.ext (auto-generated if empty)',
contentRequired: 'Content is required',
diff --git a/web/src/locales/uz.ts b/web/src/locales/uz.ts
index 33f964177d..5922c72aad 100644
--- a/web/src/locales/uz.ts
+++ b/web/src/locales/uz.ts
@@ -2901,8 +2901,6 @@ export default {
watermarkText: 'Filigran matni',
headerText: 'Yuqori kolontitul matni',
footerText: 'Quyi kolontitul matni',
- includeDownloadInfoInContent:
- 'Kontentga yuklab olish ma’lumotini qo‘shish',
contentPlaceholder: 'Markdown kontentini kiriting...',
filenamePlaceholder: 'document.ext (bo‘sh bo‘lsa avtomatik yaratiladi)',
contentRequired: 'Kontent majburiy',
diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts
index 76df6d9d6f..4babe27742 100644
--- a/web/src/locales/zh.ts
+++ b/web/src/locales/zh.ts
@@ -2555,7 +2555,6 @@ NER:使用 spaCy NER 和基于规则的关键词提取来抽取 Entities 和 R
watermarkText: '水印文本',
headerText: '页眉文本',
footerText: '页脚文本',
- includeDownloadInfoInContent: '在内容末尾附加下载信息',
contentPlaceholder: '输入 Markdown 内容...',
filenamePlaceholder: 'document.ext(留空则自动生成)',
contentRequired: '内容不能为空',
diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx
index 97827bcf52..917bc7c30a 100644
--- a/web/src/pages/agent/constant/index.tsx
+++ b/web/src/pages/agent/constant/index.tsx
@@ -1129,7 +1129,6 @@ export const initialDocGeneratorValues = {
watermark_text: '',
add_page_numbers: true,
add_timestamp: true,
- include_download_info_in_content: false,
font_size: 12,
outputs: {
doc_id: { 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 08bc30040f..fa8b45759f 100644
--- a/web/src/pages/agent/form/doc-generator-form/index.tsx
+++ b/web/src/pages/agent/form/doc-generator-form/index.tsx
@@ -31,7 +31,6 @@ const FormSchema = z.object({
watermark_text: z.string().optional(),
add_page_numbers: z.boolean(),
add_timestamp: z.boolean(),
- include_download_info_in_content: z.boolean(),
font_size: z.coerce.number().min(12, i18n.t('flow.fontSizeMin')),
outputs: z.object({
doc_id: z.object({ type: z.string() }),
@@ -80,12 +79,6 @@ function DocGeneratorForm({ node }: INextOperatorForm) {
></PromptEditor>
</RAGFlowFormItem>
- <SwitchFormField
- vertical={false}
- label={t('flow.includeDownloadInfoInContent')}
- name="include_download_info_in_content"
- />
-
<RAGFlowFormItem label={t('flow.filename')} name="filename">
<Input placeholder={t('flow.filenamePlaceholder')}></Input>
</RAGFlowFormItem>
diff --git a/web/src/pages/agent/form/doc-generator-form/use-values.ts b/web/src/pages/agent/form/doc-generator-form/use-values.ts
index d0e7100391..d48f291b74 100644
--- a/web/src/pages/agent/form/doc-generator-form/use-values.ts
+++ b/web/src/pages/agent/form/doc-generator-form/use-values.ts
@@ -17,8 +17,6 @@ export const useValues = (node?: Node) => {
).includes(nextValues.output_format)
? nextValues.output_format
: initialDocGeneratorValues.output_format,
- include_download_info_in_content:
- nextValues.include_download_info_in_content ?? false,
font_size: Math.max(12, Number(nextValues.font_size) || 12),
outputs: initialDocGeneratorValues.outputs,
};