Feat: Modify the translation file of the workflow #9869 (#10430)

### What problem does this PR solve?
Feat: Modify the translation file of the workflow #9869


### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-10-09 13:55:36 +08:00
committed by GitHub
parent 7734ad7fcd
commit 2078d88c28
7 changed files with 53 additions and 19 deletions

View File

@ -144,7 +144,7 @@ export const useFetchNextKnowledgeListByPage = () => {
const onInputChange: React.ChangeEventHandler<HTMLInputElement> = useCallback( const onInputChange: React.ChangeEventHandler<HTMLInputElement> = useCallback(
(e) => { (e) => {
// setPagination({ page: 1 }); // TODO: 这里导致重复请求 // setPagination({ page: 1 }); // TODO: This results in repeated requests
handleInputChange(e); handleInputChange(e);
}, },
[handleInputChange], [handleInputChange],
@ -323,7 +323,7 @@ export const useRemoveKnowledgeGraph = () => {
if (data.code === 0) { if (data.code === 0) {
message.success(i18n.t(`message.deleted`)); message.success(i18n.t(`message.deleted`));
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: ['fetchKnowledgeGraph'], queryKey: [KnowledgeApiAction.FetchKnowledgeGraph],
}); });
} }
return data?.code; return data?.code;

View File

@ -1531,7 +1531,7 @@ This delimiter is used to split the input text into several text pieces echo of
agentDescription: agentDescription:
'Builds agent components equipped with reasoning, tool usage, and multi-agent collaboration. ', 'Builds agent components equipped with reasoning, tool usage, and multi-agent collaboration. ',
maxRecords: 'Max records', maxRecords: 'Max records',
createAgent: 'Create Agent', createAgent: 'Agent flow',
stringTransform: 'Text Processing', stringTransform: 'Text Processing',
userFillUp: 'Await Response', userFillUp: 'Await Response',
userFillUpDescription: `Pauses the workflow and waits for the user's message before continuing.`, userFillUpDescription: `Pauses the workflow and waits for the user's message before continuing.`,
@ -1696,6 +1696,7 @@ This delimiter is used to split the input text into several text pieces echo of
parserDescription: parserDescription:
'Extracts raw text and structure from files for downstream processing.', 'Extracts raw text and structure from files for downstream processing.',
tokenizer: 'Tokenizer', tokenizer: 'Tokenizer',
tokenizerRequired: 'Please add the Tokenizer node first',
tokenizerDescription: tokenizerDescription:
'Transforms text into the required data structure (e.g., vector embeddings for Embedding Search) depending on the chosen search method.', 'Transforms text into the required data structure (e.g., vector embeddings for Embedding Search) depending on the chosen search method.',
splitter: 'Token Splitter', splitter: 'Token Splitter',
@ -1709,15 +1710,25 @@ This delimiter is used to split the input text into several text pieces echo of
'Use an LLM to extract structured insights from document chunks—such as summaries, classifications, etc.', 'Use an LLM to extract structured insights from document chunks—such as summaries, classifications, etc.',
outputFormat: 'Output format', outputFormat: 'Output format',
lang: 'Language', lang: 'Language',
fileFormats: 'File formats', fileFormats: 'File format',
fields: 'Fields', fileFormatOptions: {
pdf: 'PDF',
spreadsheet: 'Spreadsheet',
image: 'Image',
email: 'Email',
'text&markdown': 'Text & Markup',
word: 'Word',
slides: 'PPT',
audio: 'Audio',
},
fields: 'Field',
addParser: 'Add Parser', addParser: 'Add Parser',
hierarchy: 'Hierarchy', hierarchy: 'Hierarchy',
regularExpressions: 'Regular Expressions', regularExpressions: 'Regular Expressions',
overlappedPercent: 'Overlapped percent', overlappedPercent: 'Overlapped percent',
searchMethod: 'Search method', searchMethod: 'Search method',
begin: 'File', begin: 'File',
parserMethod: 'Parser method', parserMethod: 'Parsing method',
systemPrompt: 'System Prompt', systemPrompt: 'System Prompt',
systemPromptPlaceholder: systemPromptPlaceholder:
'Enter system prompt for image analysis, if empty the system default value will be used', 'Enter system prompt for image analysis, if empty the system default value will be used',
@ -1785,11 +1796,14 @@ Important structured information may include: names, dates, locations, events, k
}, },
filenameEmbeddingWeight: 'Filename embedding weight', filenameEmbeddingWeight: 'Filename embedding weight',
tokenizerFieldsOptions: { tokenizerFieldsOptions: {
text: 'Text', text: 'Processed Text',
keywords: 'Keywords', keywords: 'Keywords',
questions: 'Questions', questions: 'Questions',
summary: 'Augmented Context', summary: 'Augmented Context',
}, },
imageParseMethodOptions: {
ocr: 'OCR',
},
}, },
datasetOverview: { datasetOverview: {
downloadTip: 'Files being downloaded from data sources. ', downloadTip: 'Files being downloaded from data sources. ',

View File

@ -1454,7 +1454,7 @@ General实体和关系提取提示来自 GitHub - microsoft/graphrag基于
addAgent: '添加智能体', addAgent: '添加智能体',
agentDescription: '构建具备推理、工具调用和多智能体协同的智能体组件。', agentDescription: '构建具备推理、工具调用和多智能体协同的智能体组件。',
maxRecords: '最大记录数', maxRecords: '最大记录数',
createAgent: '创建智能体', createAgent: '智能体流程',
stringTransform: '文本处理', stringTransform: '文本处理',
userFillUp: '等待输入', userFillUp: '等待输入',
userFillUpDescription: `此组件会暂停当前的流程并等待用户发送消息,接收到消息之后再进行之后的流程。`, userFillUpDescription: `此组件会暂停当前的流程并等待用户发送消息,接收到消息之后再进行之后的流程。`,
@ -1611,6 +1611,7 @@ General实体和关系提取提示来自 GitHub - microsoft/graphrag基于
parser: '解析器', parser: '解析器',
parserDescription: '从文件中提取原始文本和结构以供下游处理。', parserDescription: '从文件中提取原始文本和结构以供下游处理。',
tokenizer: '分词器', tokenizer: '分词器',
tokenizerRequired: '请先添加Tokenizer节点',
tokenizerDescription: tokenizerDescription:
'根据所选的搜索方法,将文本转换为所需的数据结构(例如,用于嵌入搜索的向量嵌入)。', '根据所选的搜索方法,将文本转换为所需的数据结构(例如,用于嵌入搜索的向量嵌入)。',
splitter: '分词器拆分器', splitter: '分词器拆分器',

View File

@ -6,9 +6,9 @@ import {
SelectWithSearchFlagOptionType, SelectWithSearchFlagOptionType,
} from '@/components/originui/select-with-search'; } from '@/components/originui/select-with-search';
import { RAGFlowFormItem } from '@/components/ragflow-form'; import { RAGFlowFormItem } from '@/components/ragflow-form';
import { buildOptions } from '@/utils/form'; import { upperFirst } from 'lodash';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { FileType, OutputFormatMap } from '../../constant'; import { FileType, OutputFormatMap, PdfOutputFormat } from '../../constant';
import { CommonProps } from './interface'; import { CommonProps } from './interface';
import { buildFieldNameWithPrefix } from './utils'; import { buildFieldNameWithPrefix } from './utils';
@ -16,7 +16,10 @@ function buildOutputOptionsFormatMap() {
return Object.entries(OutputFormatMap).reduce< return Object.entries(OutputFormatMap).reduce<
Record<string, SelectWithSearchFlagOptionType[]> Record<string, SelectWithSearchFlagOptionType[]>
>((pre, [key, value]) => { >((pre, [key, value]) => {
pre[key] = buildOptions(value); pre[key] = Object.values(value).map((v) => ({
label: v === PdfOutputFormat.Json ? 'JSON' : upperFirst(v),
value: v,
}));
return pre; return pre;
}, {}); }, {});
} }

View File

@ -11,11 +11,14 @@ import { CommonProps } from './interface';
import { useSetInitialLanguage } from './use-set-initial-language'; import { useSetInitialLanguage } from './use-set-initial-language';
import { buildFieldNameWithPrefix } from './utils'; import { buildFieldNameWithPrefix } from './utils';
const options = buildOptions(ImageParseMethod);
export function ImageFormFields({ prefix }: CommonProps) { export function ImageFormFields({ prefix }: CommonProps) {
const { t } = useTranslation(); const { t } = useTranslation();
const form = useFormContext(); const form = useFormContext();
const options = buildOptions(
ImageParseMethod,
t,
'dataflow.imageParseMethodOptions',
);
const parseMethodName = buildFieldNameWithPrefix('parse_method', prefix); const parseMethodName = buildFieldNameWithPrefix('parse_method', prefix);
const parseMethod = useWatch({ const parseMethod = useWatch({

View File

@ -36,10 +36,6 @@ import { VideoFormFields } from './video-form-fields';
const outputList = buildOutputList(initialParserValues.outputs); const outputList = buildOutputList(initialParserValues.outputs);
const FileFormatOptions = buildOptions(FileType).filter(
(x) => x.value !== FileType.Video, // Temporarily hide the video option
);
const FileFormatWidgetMap = { const FileFormatWidgetMap = {
[FileType.PDF]: PdfFormFields, [FileType.PDF]: PdfFormFields,
[FileType.Video]: VideoFormFields, [FileType.Video]: VideoFormFields,
@ -83,6 +79,14 @@ function ParserItem({ name, index, fieldLength, remove }: ParserItemProps) {
const values = form.getValues(); const values = form.getValues();
const parserList = values.setups.slice(); // Adding, deleting, or modifying the parser array will not change the reference. const parserList = values.setups.slice(); // Adding, deleting, or modifying the parser array will not change the reference.
const FileFormatOptions = buildOptions(
FileType,
t,
'dataflow.fileFormatOptions',
).filter(
(x) => x.value !== FileType.Video, // Temporarily hide the video option
);
const filteredFileFormatOptions = useMemo(() => { const filteredFileFormatOptions = useMemo(() => {
const otherFileFormatList = parserList const otherFileFormatList = parserList
.filter((_, idx) => idx !== index) .filter((_, idx) => idx !== index)
@ -91,7 +95,7 @@ function ParserItem({ name, index, fieldLength, remove }: ParserItemProps) {
return FileFormatOptions.filter((x) => { return FileFormatOptions.filter((x) => {
return !otherFileFormatList.includes(x.value); return !otherFileFormatList.includes(x.value);
}); });
}, [index, parserList]); }, [FileFormatOptions, index, parserList]);
const Widget = const Widget =
typeof fileFormat === 'string' && fileFormat in FileFormatWidgetMap typeof fileFormat === 'string' && fileFormat in FileFormatWidgetMap

View File

@ -15,6 +15,7 @@ import {
DropdownMenuSeparator, DropdownMenuSeparator,
DropdownMenuTrigger, DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu'; } from '@/components/ui/dropdown-menu';
import message from '@/components/ui/message';
import { useSetModalState } from '@/hooks/common-hooks'; import { useSetModalState } from '@/hooks/common-hooks';
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks'; import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
import { ReactFlowProvider } from '@xyflow/react'; import { ReactFlowProvider } from '@xyflow/react';
@ -30,6 +31,7 @@ import { ComponentPropsWithoutRef, useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import DataFlowCanvas from './canvas'; import DataFlowCanvas from './canvas';
import { DropdownProvider } from './canvas/context'; import { DropdownProvider } from './canvas/context';
import { Operator } from './constant';
import { LogContext } from './context'; import { LogContext } from './context';
import { useCancelCurrentDataflow } from './hooks/use-cancel-dataflow'; import { useCancelCurrentDataflow } from './hooks/use-cancel-dataflow';
import { useHandleExportOrImportJsonFile } from './hooks/use-export-json'; import { useHandleExportOrImportJsonFile } from './hooks/use-export-json';
@ -42,6 +44,7 @@ import {
} from './hooks/use-save-graph'; } from './hooks/use-save-graph';
import { LogSheet } from './log-sheet'; import { LogSheet } from './log-sheet';
import { SettingDialog } from './setting-dialog'; import { SettingDialog } from './setting-dialog';
import useGraphStore from './store';
import { useAgentHistoryManager } from './use-agent-history-manager'; import { useAgentHistoryManager } from './use-agent-history-manager';
import { VersionDialog } from './version-dialog'; import { VersionDialog } from './version-dialog';
@ -101,8 +104,14 @@ export default function DataFlow() {
const [uploadedFileData, setUploadedFileData] = const [uploadedFileData, setUploadedFileData] =
useState<Record<string, any>>(); useState<Record<string, any>>();
const findNodeByName = useGraphStore((state) => state.findNodeByName);
const handleRunAgent = useCallback(() => { const handleRunAgent = useCallback(() => {
if (!findNodeByName(Operator.Tokenizer)) {
message.warning(t('dataflow.tokenizerRequired'));
return;
}
if (isParsing) { if (isParsing) {
// show log sheet // show log sheet
showLogSheet(); showLogSheet();
@ -110,7 +119,7 @@ export default function DataFlow() {
hideLogSheet(); hideLogSheet();
handleRun(); handleRun();
} }
}, [handleRun, hideLogSheet, isParsing, showLogSheet]); }, [findNodeByName, handleRun, hideLogSheet, isParsing, showLogSheet, t]);
const { handleCancel } = useCancelCurrentDataflow({ const { handleCancel } = useCancelCurrentDataflow({
messageId, messageId,