mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-07-14 15:51:50 +08:00
### What problem does this PR solve? feat: Add tooltip to clean_html item #2908 ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe):
This commit is contained in:
parent
dd1146ec64
commit
16b6a78c1e
@ -31,7 +31,7 @@ export default defineConfig({
|
|||||||
proxy: [
|
proxy: [
|
||||||
{
|
{
|
||||||
context: ['/api', '/v1'],
|
context: ['/api', '/v1'],
|
||||||
target: 'http://127.0.0.1:9380/',
|
target: 'http://127.0.0.1:9456/',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
ws: true,
|
ws: true,
|
||||||
logger: console,
|
logger: console,
|
||||||
|
@ -1025,9 +1025,12 @@ The above is the content you need to summarize.`,
|
|||||||
method: 'Method',
|
method: 'Method',
|
||||||
timeout: 'Timeout',
|
timeout: 'Timeout',
|
||||||
headers: 'Headers',
|
headers: 'Headers',
|
||||||
cleanHtml: 'Clean html',
|
cleanHtml: 'Clean HTML',
|
||||||
|
cleanHtmlTip:
|
||||||
|
'If the response is HTML formatted and only the primary content wanted, please toggle it on.',
|
||||||
reference: 'Reference',
|
reference: 'Reference',
|
||||||
input: 'Input',
|
input: 'Input',
|
||||||
|
parameter: 'Parameter',
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
profile: 'All rights reserved @ React',
|
profile: 'All rights reserved @ React',
|
||||||
|
@ -974,9 +974,11 @@ export default {
|
|||||||
method: '方法',
|
method: '方法',
|
||||||
timeout: '超時',
|
timeout: '超時',
|
||||||
headers: '請求頭',
|
headers: '請求頭',
|
||||||
cleanHtml: '清除 html',
|
cleanHtml: '清除 HTML',
|
||||||
|
cleanHtmlTip: '如果回應是 HTML 格式並且只需要主要內容,請將其開啟。',
|
||||||
reference: '引用',
|
reference: '引用',
|
||||||
input: '輸入',
|
input: '輸入',
|
||||||
|
parameter: '參數',
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
profile: '“保留所有權利 @ react”',
|
profile: '“保留所有權利 @ react”',
|
||||||
|
@ -994,9 +994,11 @@ export default {
|
|||||||
method: '方法',
|
method: '方法',
|
||||||
timeout: '超时',
|
timeout: '超时',
|
||||||
headers: '请求头',
|
headers: '请求头',
|
||||||
cleanHtml: '清除 html',
|
cleanHtml: '清除 HTML',
|
||||||
|
cleanHtmlTip: '如果响应是 HTML 格式且只需要主要内容,请将其打开。',
|
||||||
reference: '引用',
|
reference: '引用',
|
||||||
input: '输入',
|
input: '输入',
|
||||||
|
parameter: '参数',
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
profile: 'All rights reserved @ React',
|
profile: 'All rights reserved @ React',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { EditableCell, EditableRow } from '@/components/editable-cell';
|
import { EditableCell, EditableRow } from '@/components/editable-cell';
|
||||||
import { useTranslate } from '@/hooks/common-hooks';
|
import { useTranslate } from '@/hooks/common-hooks';
|
||||||
import { DeleteOutlined } from '@ant-design/icons';
|
import { DeleteOutlined } from '@ant-design/icons';
|
||||||
import { Button, Flex, Input, Select, Table, TableProps } from 'antd';
|
import { Button, Collapse, Flex, Input, Select, Table, TableProps } from 'antd';
|
||||||
import { useBuildComponentIdSelectOptions } from '../../hooks';
|
import { useBuildComponentIdSelectOptions } from '../../hooks';
|
||||||
import { IInvokeVariable } from '../../interface';
|
import { IInvokeVariable } from '../../interface';
|
||||||
import { useHandleOperateParameters } from './hooks';
|
import { useHandleOperateParameters } from './hooks';
|
||||||
@ -20,7 +20,7 @@ const components = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const DynamicVariables = ({ nodeId }: IProps) => {
|
const DynamicVariablesForm = ({ nodeId }: IProps) => {
|
||||||
const { t } = useTranslate('flow');
|
const { t } = useTranslate('flow');
|
||||||
|
|
||||||
const options = useBuildComponentIdSelectOptions(nodeId);
|
const options = useBuildComponentIdSelectOptions(nodeId);
|
||||||
@ -95,24 +95,35 @@ const DynamicVariables = ({ nodeId }: IProps) => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section>
|
<Collapse
|
||||||
<Flex justify="end">
|
className={styles.dynamicParameterVariable}
|
||||||
<Button size="small" onClick={handleAdd}>
|
defaultActiveKey={['1']}
|
||||||
{t('add')}
|
items={[
|
||||||
</Button>
|
{
|
||||||
</Flex>
|
key: '1',
|
||||||
<Table
|
label: (
|
||||||
dataSource={dataSource}
|
<Flex justify={'space-between'}>
|
||||||
columns={columns}
|
<span className={styles.title}>{t('parameter')}</span>
|
||||||
rowKey={'id'}
|
<Button size="small" onClick={handleAdd}>
|
||||||
className={styles.variableTable}
|
{t('add')}
|
||||||
components={components}
|
</Button>
|
||||||
rowClassName={() => styles.editableRow}
|
</Flex>
|
||||||
scroll={{ x: true }}
|
),
|
||||||
bordered
|
children: (
|
||||||
/>
|
<Table
|
||||||
</section>
|
dataSource={dataSource}
|
||||||
|
columns={columns}
|
||||||
|
rowKey={'id'}
|
||||||
|
components={components}
|
||||||
|
rowClassName={() => styles.editableRow}
|
||||||
|
scroll={{ x: true }}
|
||||||
|
bordered
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default DynamicVariables;
|
export default DynamicVariablesForm;
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import { ChangeEventHandler, useCallback, useMemo } from 'react';
|
import {
|
||||||
|
ChangeEventHandler,
|
||||||
|
MouseEventHandler,
|
||||||
|
useCallback,
|
||||||
|
useMemo,
|
||||||
|
} from 'react';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
import { IGenerateParameter, IInvokeVariable } from '../../interface';
|
import { IGenerateParameter, IInvokeVariable } from '../../interface';
|
||||||
import useGraphStore from '../../store';
|
import useGraphStore from '../../store';
|
||||||
@ -50,19 +55,24 @@ export const useHandleOperateParameters = (nodeId: string) => {
|
|||||||
[updateNodeForm, nodeId, dataSource],
|
[updateNodeForm, nodeId, dataSource],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleAdd = useCallback(() => {
|
const handleAdd: MouseEventHandler = useCallback(
|
||||||
updateNodeForm(nodeId, {
|
(e) => {
|
||||||
variables: [
|
e.preventDefault();
|
||||||
...dataSource,
|
e.stopPropagation();
|
||||||
{
|
updateNodeForm(nodeId, {
|
||||||
id: uuid(),
|
variables: [
|
||||||
key: '',
|
...dataSource,
|
||||||
component_id: undefined,
|
{
|
||||||
value: '',
|
id: uuid(),
|
||||||
},
|
key: '',
|
||||||
],
|
component_id: undefined,
|
||||||
});
|
value: '',
|
||||||
}, [dataSource, nodeId, updateNodeForm]);
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[dataSource, nodeId, updateNodeForm],
|
||||||
|
);
|
||||||
|
|
||||||
const handleSave = (row: IGenerateParameter) => {
|
const handleSave = (row: IGenerateParameter) => {
|
||||||
const newData = [...dataSource];
|
const newData = [...dataSource];
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
.variableTable {
|
|
||||||
margin-top: 14px;
|
|
||||||
}
|
|
||||||
.editableRow {
|
.editableRow {
|
||||||
:global(.editable-cell) {
|
:global(.editable-cell) {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -19,3 +16,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dynamicParameterVariable {
|
||||||
|
background-color: #ebe9e9;
|
||||||
|
:global(.ant-collapse-content) {
|
||||||
|
background-color: #f6f6f6;
|
||||||
|
}
|
||||||
|
:global(.ant-collapse-content-box) {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
margin-bottom: 20px;
|
||||||
|
.title {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
.variableType {
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
.variableValue {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addButton {
|
||||||
|
color: rgb(22, 119, 255);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -3,7 +3,7 @@ import { Form, Input, InputNumber, Select, Space, Switch } from 'antd';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useSetLlmSetting } from '../../hooks';
|
import { useSetLlmSetting } from '../../hooks';
|
||||||
import { IOperatorForm } from '../../interface';
|
import { IOperatorForm } from '../../interface';
|
||||||
import DynamicVariables from './dynamic-variables';
|
import DynamicVariablesForm from './dynamic-variables';
|
||||||
|
|
||||||
enum Method {
|
enum Method {
|
||||||
GET = 'GET',
|
GET = 'GET',
|
||||||
@ -63,10 +63,14 @@ const InvokeForm = ({ onValuesChange, form, node }: IOperatorForm) => {
|
|||||||
<Form.Item name={'proxy'} label={t('flow.proxy')}>
|
<Form.Item name={'proxy'} label={t('flow.proxy')}>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name={'clean_html'} label={t('flow.cleanHtml')}>
|
<Form.Item
|
||||||
|
name={'clean_html'}
|
||||||
|
label={t('flow.cleanHtml')}
|
||||||
|
tooltip={t('flow.cleanHtmlTip')}
|
||||||
|
>
|
||||||
<Switch />
|
<Switch />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<DynamicVariables nodeId={node?.id}></DynamicVariables>
|
<DynamicVariablesForm nodeId={node?.id}></DynamicVariablesForm>
|
||||||
</Form>
|
</Form>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user