Feat: Move the pipeline translation field to flow #9869 (#10697)

### What problem does this PR solve?

Feat: Move the pipeline translation field to flow #9869

### Type of change


- [X] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-10-21 15:23:37 +08:00
committed by GitHub
parent 41a647fe32
commit 544c9990e3
18 changed files with 234 additions and 250 deletions

View File

@ -36,7 +36,7 @@ function InnerFileNode({ data, id, selected }: NodeProps<IBeginNode>) {
<section className="flex items-center gap-2">
<OperatorIcon name={data.label as Operator}></OperatorIcon>
<div className="truncate text-center font-semibold text-sm">
{t(`dataflow.begin`)}
{t(`flow.begin`)}
</div>
</section>
<section className={cn(styles.generateParameters, 'flex gap-2 flex-col')}>

View File

@ -46,7 +46,7 @@ function ParserNode({
className="flex flex-col text-text-primary gap-1"
>
<span className="text-text-secondary">Parser {idx + 1}</span>
{t(`dataflow.fileFormatOptions.${x.fileFormat}`)}
{t(`flow.fileFormatOptions.${x.fileFormat}`)}
</LabelCard>
)}
</NodeCollapsible>

View File

@ -38,12 +38,10 @@ function TokenizerNode({
></CommonHandle>
<NodeHeader id={id} name={data.name} label={data.label}></NodeHeader>
<LabelCard className="text-text-primary flex justify-between flex-col gap-1">
<span className="text-text-secondary">
{t('dataflow.searchMethod')}
</span>
<span className="text-text-secondary">{t('flow.searchMethod')}</span>
<ul className="space-y-1">
{data.form?.search_method.map((x) => (
<li key={x}>{t(`dataflow.tokenizerSearchMethodOptions.${x}`)}</li>
<li key={x}>{t(`flow.tokenizerSearchMethodOptions.${x}`)}</li>
))}
</ul>
</LabelCard>

View File

@ -47,7 +47,7 @@ const ExtractorForm = ({ node }: INextOperatorForm) => {
const promptOptions = useBuildNodeOutputOptions(node?.id);
const options = buildOptions(ContextGeneratorFieldName, t, 'dataflow');
const options = buildOptions(ContextGeneratorFieldName, t, 'flow');
const {
handleFieldNameChange,
@ -63,7 +63,7 @@ const ExtractorForm = ({ node }: INextOperatorForm) => {
<Form {...form}>
<FormWrapper>
<LargeModelFormField></LargeModelFormField>
<RAGFlowFormItem label={t('dataflow.fieldName')} name="field_name">
<RAGFlowFormItem label={t('flow.fieldName')} name="field_name">
{(field) => (
<SelectWithSearch
onChange={(value) => {
@ -93,7 +93,7 @@ const ExtractorForm = ({ node }: INextOperatorForm) => {
</FormWrapper>
{visible && (
<ConfirmDeleteDialog
title={t('dataflow.switchPromptMessage')}
title={t('flow.switchPromptMessage')}
open
onOpenChange={hideModal}
onOk={confirmSwitch}

View File

@ -21,7 +21,7 @@ export function useSwitchPrompt(form: UseFormReturn<ExtractorFormSchemaType>) {
const setPromptValue = useCallback(
(field: keyof ExtractorFormSchemaType, key: string, value: string) => {
form.setValue(field, t(`dataflow.prompts.${key}.${value}`), {
form.setValue(field, t(`flow.prompts.${key}.${value}`), {
shouldDirty: true,
shouldValidate: true,
});

View File

@ -98,7 +98,7 @@ export function RegularExpressions({
</CardHeader>
<CardContent>
<FormLabel required className="mb-2 text-text-secondary">
{t('dataflow.regularExpressions')}
{t('flow.regularExpressions')}
</FormLabel>
<section className="space-y-4">
{fields.map((field, index) => (
@ -158,7 +158,7 @@ const HierarchicalMergerForm = ({ node }: INextOperatorForm) => {
return (
<Form {...form}>
<FormWrapper>
<RAGFlowFormItem name={'hierarchy'} label={t('dataflow.hierarchy')}>
<RAGFlowFormItem name={'hierarchy'} label={t('flow.hierarchy')}>
<SelectWithSearch options={HierarchyOptions}></SelectWithSearch>
</RAGFlowFormItem>
{fields.map((field, index) => (

View File

@ -50,7 +50,7 @@ export function OutputFormatFormField({
return (
<RAGFlowFormItem
name={buildFieldNameWithPrefix(`output_format`, prefix)}
label={t('dataflow.outputFormat')}
label={t('flow.outputFormat')}
>
<SelectWithSearch
options={buildOutputOptionsFormatMap()[fileType]}
@ -69,7 +69,7 @@ export function ParserMethodFormField({
name={buildFieldNameWithPrefix(`parse_method`, prefix)}
horizontal={false}
optionsWithoutLLM={optionsWithoutLLM}
label={t('dataflow.parserMethod')}
label={t('flow.parserMethod')}
></LayoutRecognizeFormField>
);
}
@ -92,7 +92,7 @@ export function LanguageFormField({ prefix }: CommonProps) {
return (
<RAGFlowFormItem
name={buildFieldNameWithPrefix(`lang`, prefix)}
label={t('dataflow.lang')}
label={t('flow.lang')}
>
{(field) => (
<SelectWithSearch

View File

@ -14,7 +14,7 @@ export function EmailFormFields({ prefix }: CommonProps) {
<>
<RAGFlowFormItem
name={buildFieldNameWithPrefix(`fields`, prefix)}
label={t('dataflow.fields')}
label={t('flow.fields')}
>
{(field) => (
<MultiSelect

View File

@ -17,7 +17,7 @@ export function ImageFormFields({ prefix }: CommonProps) {
const options = buildOptions(
ImageParseMethod,
t,
'dataflow.imageParseMethodOptions',
'flow.imageParseMethodOptions',
);
const parseMethodName = buildFieldNameWithPrefix('parse_method', prefix);
@ -50,9 +50,9 @@ export function ImageFormFields({ prefix }: CommonProps) {
{languageShown && (
<RAGFlowFormItem
name={buildFieldNameWithPrefix('system_prompt', prefix)}
label={t('dataflow.systemPrompt')}
label={t('flow.systemPrompt')}
>
<Textarea placeholder={t('dataflow.systemPromptPlaceholder')} />
<Textarea placeholder={t('flow.systemPromptPlaceholder')} />
</RAGFlowFormItem>
)}
</>

View File

@ -133,7 +133,7 @@ function ParserItem({
</div>
<RAGFlowFormItem
name={buildFieldNameWithPrefix(`fileFormat`, prefix)}
label={t('dataflow.fileFormats')}
label={t('flow.fileFormats')}
>
{(field) => (
<SelectWithSearch
@ -165,7 +165,7 @@ const ParserForm = ({ node }: INextOperatorForm) => {
const FileFormatOptions = buildOptions(
FileType,
t,
'dataflow.fileFormatOptions',
'flow.fileFormatOptions',
).filter(
(x) => x.value !== FileType.Video, // Temporarily hide the video option
);
@ -212,7 +212,7 @@ const ParserForm = ({ node }: INextOperatorForm) => {
})}
{fields.length < FileFormatOptions.length && (
<BlockButton onClick={add} type="button" className="mt-2.5">
{t('dataflow.addParser')}
{t('flow.addParser')}
</BlockButton>
)}
</form>

View File

@ -60,7 +60,7 @@ const SplitterForm = ({ node }: INextOperatorForm) => {
name="overlapped_percent"
max={30}
min={0}
label={t('dataflow.overlappedPercent')}
label={t('flow.overlappedPercent')}
></SliderInputFormField>
<section>
<span className="mb-2 inline-block">{t('flow.delimiters')}</span>

View File

@ -38,12 +38,12 @@ const TokenizerForm = ({ node }: INextOperatorForm) => {
const SearchMethodOptions = buildOptions(
TokenizerSearchMethod,
t,
`dataflow.tokenizerSearchMethodOptions`,
`flow.tokenizerSearchMethodOptions`,
);
const FieldsOptions = buildOptions(
TokenizerFields,
t,
'dataflow.tokenizerFieldsOptions',
'flow.tokenizerFieldsOptions',
);
const form = useForm<TokenizerFormSchemaType>({
@ -59,8 +59,8 @@ const TokenizerForm = ({ node }: INextOperatorForm) => {
<FormWrapper>
<RAGFlowFormItem
name="search_method"
label={t('dataflow.searchMethod')}
tooltip={t('dataflow.searchMethodTip')}
label={t('flow.searchMethod')}
tooltip={t('flow.searchMethodTip')}
>
{(field) => (
<MultiSelect
@ -73,11 +73,11 @@ const TokenizerForm = ({ node }: INextOperatorForm) => {
</RAGFlowFormItem>
<SliderInputFormField
name="filename_embd_weight"
label={t('dataflow.filenameEmbeddingWeight')}
label={t('flow.filenameEmbeddingWeight')}
max={0.5}
step={0.01}
></SliderInputFormField>
<RAGFlowFormItem name="fields" label={t('dataflow.fields')}>
<RAGFlowFormItem name="fields" label={t('flow.fields')}>
{(field) => <SelectWithSearch options={FieldsOptions} {...field} />}
</RAGFlowFormItem>
</FormWrapper>

View File

@ -128,8 +128,8 @@ export const useInitializeOperatorParams = () => {
[Operator.Extractor]: {
...initialExtractorValues,
llm_id: llmId,
sys_prompt: t('dataflow.prompts.system.summary'),
prompts: t('dataflow.prompts.user.summary'),
sys_prompt: t('flow.prompts.system.summary'),
prompts: t('flow.prompts.user.summary'),
},
};
}, [llmId]);

View File

@ -61,7 +61,7 @@ export const useShowSingleDebugDrawer = () => {
};
};
const ExcludedNodes = [Operator.Note, Operator.Placeholder];
const ExcludedNodes = [Operator.Note, Operator.Placeholder, Operator.File];
export function useShowDrawer({
drawerVisible,

View File

@ -137,7 +137,7 @@ export default function Agent() {
const handleRunPipeline = useCallback(() => {
if (!findNodeByName(Operator.Tokenizer)) {
message.warning(t('dataflow.tokenizerRequired'));
message.warning(t('flow.tokenizerRequired'));
return;
}

View File

@ -77,7 +77,7 @@ export function PipelineLogSheet({
uploadedFileData?.extension,
})}
>
{t('dataflow.viewResult')} <ArrowUpRight />
{t('flow.viewResult')} <ArrowUpRight />
</Button>
)}
</SheetTitle>
@ -95,7 +95,7 @@ export function PipelineLogSheet({
className="w-full mt-8 bg-state-error/10 text-state-error hover:bg-state-error hover:text-bg-base"
onClick={handleCancel}
>
<CirclePause /> {t('dataflow.cancel')}
<CirclePause /> {t('flow.cancel')}
</Button>
) : (
<Button
@ -104,7 +104,7 @@ export function PipelineLogSheet({
className="w-full mt-8 bg-accent-primary-5 text-text-secondary hover:bg-accent-primary-5 hover:text-accent-primary hover:border-accent-primary hover:border"
>
<SquareArrowOutUpRight />
{t('dataflow.exportJson')}
{t('flow.exportJson')}
</Button>
)}
</div>