mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 06:55:56 +08:00
### What problem does this PR solve? feat: Delete Answer and Relevant from RestrictedUpstreamMap of Switch #1739 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
c5c3240c4c
commit
11dd23d8aa
@ -563,7 +563,7 @@ export default {
|
|||||||
yes: '是',
|
yes: '是',
|
||||||
no: '否',
|
no: '否',
|
||||||
key: 'key',
|
key: 'key',
|
||||||
componentId: '組件id',
|
componentId: '組件ID',
|
||||||
add: '新增',
|
add: '新增',
|
||||||
operation: '操作',
|
operation: '操作',
|
||||||
run: '運行',
|
run: '運行',
|
||||||
|
@ -582,7 +582,7 @@ export default {
|
|||||||
yes: '是',
|
yes: '是',
|
||||||
no: '否',
|
no: '否',
|
||||||
key: 'key',
|
key: 'key',
|
||||||
componentId: '组件id',
|
componentId: '组件ID',
|
||||||
add: '新增',
|
add: '新增',
|
||||||
operation: '操作',
|
operation: '操作',
|
||||||
run: '运行',
|
run: '运行',
|
||||||
|
@ -471,7 +471,7 @@ export const RestrictedUpstreamMap = {
|
|||||||
[Operator.BaiduFanyi]: [Operator.Begin, Operator.Retrieval],
|
[Operator.BaiduFanyi]: [Operator.Begin, Operator.Retrieval],
|
||||||
[Operator.QWeather]: [Operator.Begin, Operator.Retrieval],
|
[Operator.QWeather]: [Operator.Begin, Operator.Retrieval],
|
||||||
[Operator.ExeSQL]: [Operator.Begin],
|
[Operator.ExeSQL]: [Operator.Begin],
|
||||||
[Operator.Switch]: [Operator.Begin, Operator.Answer, Operator.Relevant],
|
[Operator.Switch]: [Operator.Begin],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const NodeMap = {
|
export const NodeMap = {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { CloseOutlined } from '@ant-design/icons';
|
import { CloseOutlined } from '@ant-design/icons';
|
||||||
import { Button, Card, Form, Input, Select, Typography } from 'antd';
|
import { Button, Card, Divider, Form, Input, Select, Typography } from 'antd';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import {
|
import {
|
||||||
@ -14,11 +14,11 @@ import { IOperatorForm, ISwitchForm } from '../interface';
|
|||||||
import { getOtherFieldValues } from '../utils';
|
import { getOtherFieldValues } from '../utils';
|
||||||
|
|
||||||
const subLabelCol = {
|
const subLabelCol = {
|
||||||
span: 9,
|
span: 11,
|
||||||
};
|
};
|
||||||
|
|
||||||
const subWrapperCol = {
|
const subWrapperCol = {
|
||||||
span: 15,
|
span: 13,
|
||||||
};
|
};
|
||||||
|
|
||||||
const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
|
const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
|
||||||
@ -53,27 +53,21 @@ const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
labelCol={{ span: 4 }}
|
labelCol={{ span: 8 }}
|
||||||
wrapperCol={{ span: 20 }}
|
wrapperCol={{ span: 16 }}
|
||||||
form={form}
|
form={form}
|
||||||
name="dynamic_form_complex"
|
name="dynamic_form_complex"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
initialValues={{ conditions: [{}] }}
|
initialValues={{ conditions: [{}] }}
|
||||||
onValuesChange={onValuesChange}
|
onValuesChange={onValuesChange}
|
||||||
>
|
>
|
||||||
<Form.Item label={t('flow.to')} name={[SwitchElseTo]}>
|
|
||||||
<Select
|
|
||||||
allowClear
|
|
||||||
options={buildCategorizeToOptions(getSelectedConditionTos())}
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
<Form.List name="conditions">
|
<Form.List name="conditions">
|
||||||
{(fields, { add, remove }) => (
|
{(fields, { add, remove }) => (
|
||||||
<div style={{ display: 'flex', rowGap: 16, flexDirection: 'column' }}>
|
<div style={{ display: 'flex', rowGap: 16, flexDirection: 'column' }}>
|
||||||
{fields.map((field) => (
|
{fields.map((field) => (
|
||||||
<Card
|
<Card
|
||||||
size="small"
|
size="small"
|
||||||
title={`Item ${field.name + 1}`}
|
title={`Case ${field.name + 1}`}
|
||||||
key={field.key}
|
key={field.key}
|
||||||
extra={
|
extra={
|
||||||
<CloseOutlined
|
<CloseOutlined
|
||||||
@ -105,7 +99,7 @@ const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
|
|||||||
])}
|
])}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label=" " colon={false}>
|
<Form.Item label="Condition">
|
||||||
<Form.List name={[field.name, 'items']}>
|
<Form.List name={[field.name, 'items']}>
|
||||||
{(subFields, subOpt) => (
|
{(subFields, subOpt) => (
|
||||||
<div
|
<div
|
||||||
@ -165,7 +159,7 @@ const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
|
|||||||
onClick={() => subOpt.add()}
|
onClick={() => subOpt.add()}
|
||||||
block
|
block
|
||||||
>
|
>
|
||||||
+ {t('flow.addSubItem')}
|
+ Add Condition
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -175,11 +169,18 @@ const SwitchForm = ({ onValuesChange, node, form }: IOperatorForm) => {
|
|||||||
))}
|
))}
|
||||||
|
|
||||||
<Button type="dashed" onClick={() => add()} block>
|
<Button type="dashed" onClick={() => add()} block>
|
||||||
+ {t('flow.addItem')}
|
+ Add Case
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Form.List>
|
</Form.List>
|
||||||
|
<Divider />
|
||||||
|
<Form.Item label={'ELSE'} name={[SwitchElseTo]}>
|
||||||
|
<Select
|
||||||
|
allowClear
|
||||||
|
options={buildCategorizeToOptions(getSelectedConditionTos())}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item noStyle shouldUpdate>
|
<Form.Item noStyle shouldUpdate>
|
||||||
{() => (
|
{() => (
|
||||||
|
@ -232,5 +232,5 @@ export const getOtherFieldValues = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
export const generateSwitchHandleText = (idx: number) => {
|
export const generateSwitchHandleText = (idx: number) => {
|
||||||
return `Item ${idx + 1}`;
|
return `Case ${idx + 1}`;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user