Fix: preserve doc generator download metadata in message (#14626)

### What problem does this PR solve?

preserve doc generator download metadata

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
buua436
2026-05-07 15:48:36 +08:00
committed by GitHub
parent c50028b1f3
commit 5b162a0c46
5 changed files with 60 additions and 2 deletions

View File

@@ -973,6 +973,7 @@ export const initialDocGeneratorValues = {
watermark_text: '',
add_page_numbers: true,
add_timestamp: true,
include_download_info_in_content: false,
font_size: 12,
outputs: {
download: { type: 'string' },

View File

@@ -11,9 +11,9 @@ import { Input } from '@/components/ui/input';
import { RAGFlowSelect } from '@/components/ui/select';
import { Switch } from '@/components/ui/switch';
import { zodResolver } from '@hookform/resolvers/zod';
import { t } from 'i18next';
import { memo, useEffect, useMemo } from 'react';
import { useForm } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import { z } from 'zod';
import { INextOperatorForm } from '../../interface';
import { FormWrapper } from '../components/form-wrapper';
@@ -23,6 +23,7 @@ import { useValues } from './use-values';
import { useWatchFormChange } from './use-watch-form-change';
function DocGeneratorForm({ node }: INextOperatorForm) {
const { t } = useTranslation();
const values = useValues(node);
const FormSchema = z.object({
@@ -34,6 +35,7 @@ function DocGeneratorForm({ node }: INextOperatorForm) {
watermark: 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, 'Font size must be at least 12'),
outputs: z.object({
download: z.object({ type: z.string() }),
@@ -113,6 +115,29 @@ function DocGeneratorForm({ node }: INextOperatorForm) {
)}
/>
<FormField
control={form.control}
name="include_download_info_in_content"
render={({ field }) => (
<FormItem className="flex flex-row items-center justify-between gap-4">
<div className="space-y-1">
<FormLabel>
{t(
'flow.includeDownloadInfoInContent',
'Append download info to content',
)}
</FormLabel>
</div>
<FormControl>
<Switch
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
</FormItem>
)}
/>
<FormField
control={form.control}
name="filename"

View File

@@ -21,6 +21,8 @@ export const useValues = (node?: Node) => {
watermark_text: nextValues.watermark_text,
add_page_numbers: nextValues.add_page_numbers,
add_timestamp: nextValues.add_timestamp,
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,
};