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