fix: transformer toc prompt text incorrect (#12116)

### What problem does this PR solve?

Fix incorrect prompt texts in **Agent** canvas > **Transformer** >
**Result destination: Table of contents**

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Jimmy Ben Klieve
2025-12-23 15:59:09 +08:00
committed by GitHub
parent 2369be7244
commit b47f1afa35
2 changed files with 25 additions and 16 deletions

View File

@ -1789,6 +1789,7 @@ This delimiter is used to split the input text into several text pieces echo of
variableSettings: 'Variable settings', variableSettings: 'Variable settings',
systemPrompt: 'System prompt', systemPrompt: 'System prompt',
userPrompt: 'User prompt', userPrompt: 'User prompt',
tocDataSource: 'Data source',
addCategory: 'Add category', addCategory: 'Add category',
categoryName: 'Category name', categoryName: 'Category name',
nextStep: 'Next step', nextStep: 'Next step',
@ -2024,6 +2025,7 @@ Key Instructions:
metadata: `Extract important structured information from the given content. Output ONLY a valid JSON string with no additional text. If no important structured information is found, output an empty JSON object: {}. metadata: `Extract important structured information from the given content. Output ONLY a valid JSON string with no additional text. If no important structured information is found, output an empty JSON object: {}.
Important structured information may include: names, dates, locations, events, key facts, numerical data, or other extractable entities.`, Important structured information may include: names, dates, locations, events, key facts, numerical data, or other extractable entities.`,
toc: '',
}, },
user: { user: {
keywords: `Text Content keywords: `Text Content
@ -2033,6 +2035,7 @@ Important structured information may include: names, dates, locations, events, k
summary: `Text to Summarize: summary: `Text to Summarize:
[Insert text here]`, [Insert text here]`,
metadata: `Content: [INSERT CONTENT HERE]`, metadata: `Content: [INSERT CONTENT HERE]`,
toc: '[Insert text here]',
}, },
}, },
cancel: 'Cancel', cancel: 'Cancel',

View File

@ -59,6 +59,8 @@ const ExtractorForm = ({ node }: INextOperatorForm) => {
useWatchFormChange(node?.id, form); useWatchFormChange(node?.id, form);
const isToc = form.getValues('field_name') === 'toc';
return ( return (
<Form {...form}> <Form {...form}>
<FormWrapper> <FormWrapper>
@ -76,23 +78,27 @@ const ExtractorForm = ({ node }: INextOperatorForm) => {
></SelectWithSearch> ></SelectWithSearch>
)} )}
</RAGFlowFormItem> </RAGFlowFormItem>
{form.getValues('field_name') !== 'toc' && (
<> {!isToc && (
<RAGFlowFormItem label={t('flow.systemPrompt')} name="sys_prompt"> <RAGFlowFormItem label={t('flow.systemPrompt')} name="sys_prompt">
<PromptEditor <PromptEditor
placeholder={t('flow.messagePlaceholder')} placeholder={t('flow.messagePlaceholder')}
showToolbar={true} showToolbar={true}
baseOptions={promptOptions} baseOptions={promptOptions}
></PromptEditor> ></PromptEditor>
</RAGFlowFormItem> </RAGFlowFormItem>
<RAGFlowFormItem label={t('flow.userPrompt')} name="prompts">
<PromptEditor
showToolbar={true}
baseOptions={promptOptions}
></PromptEditor>
</RAGFlowFormItem>
</>
)} )}
<RAGFlowFormItem
label={isToc ? t('flow.tocDataSource') : t('flow.userPrompt')}
name="prompts"
>
<PromptEditor
showToolbar={true}
baseOptions={promptOptions}
></PromptEditor>
</RAGFlowFormItem>
<Output list={outputList}></Output> <Output list={outputList}></Output>
</FormWrapper> </FormWrapper>
{visible && ( {visible && (