mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-06-30 00:55:10 +08:00
### What problem does this PR solve? feat: Add InvokeNode #1908 ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
2d1fbefdb5
commit
3ed096fd3f
@ -78,7 +78,7 @@ export const EditableCell: React.FC<EditableCellProps> = ({
|
||||
if (editable) {
|
||||
childNode = editing ? (
|
||||
<Form.Item
|
||||
style={{ margin: 0, width: 100 }}
|
||||
style={{ margin: 0, width: 70 }}
|
||||
name={dataIndex}
|
||||
rules={[
|
||||
{
|
||||
@ -95,7 +95,7 @@ export const EditableCell: React.FC<EditableCellProps> = ({
|
||||
// style={{ paddingRight: 24 }}
|
||||
onClick={toggleEdit}
|
||||
>
|
||||
<Text ellipsis={{ tooltip: children }} style={{ width: 100 }}>
|
||||
<Text ellipsis={{ tooltip: children }} style={{ width: 70 }}>
|
||||
{children}
|
||||
</Text>
|
||||
</div>
|
||||
|
@ -1023,6 +1023,7 @@ The above is the content you need to summarize.`,
|
||||
method: 'Method',
|
||||
timeout: 'Timeout',
|
||||
headers: 'Headers',
|
||||
cleanHtml: 'Clean html',
|
||||
},
|
||||
footer: {
|
||||
profile: 'All rights reserved @ React',
|
||||
|
@ -972,6 +972,7 @@ export default {
|
||||
method: '方法',
|
||||
timeout: '超時',
|
||||
headers: '請求頭',
|
||||
cleanHtml: '清除 html',
|
||||
},
|
||||
footer: {
|
||||
profile: '“保留所有權利 @ react”',
|
||||
|
@ -992,6 +992,7 @@ export default {
|
||||
method: '方法',
|
||||
timeout: '超时',
|
||||
headers: '请求头',
|
||||
cleanHtml: '清除 html',
|
||||
},
|
||||
footer: {
|
||||
profile: 'All rights reserved @ React',
|
||||
|
@ -23,6 +23,7 @@ import { RagNode } from './node';
|
||||
import { BeginNode } from './node/begin-node';
|
||||
import { CategorizeNode } from './node/categorize-node';
|
||||
import { GenerateNode } from './node/generate-node';
|
||||
import { InvokeNode } from './node/invoke-node';
|
||||
import { KeywordNode } from './node/keyword-node';
|
||||
import { LogicNode } from './node/logic-node';
|
||||
import { MessageNode } from './node/message-node';
|
||||
@ -45,6 +46,7 @@ const nodeTypes = {
|
||||
messageNode: MessageNode,
|
||||
rewriteNode: RewriteNode,
|
||||
keywordNode: KeywordNode,
|
||||
invokeNode: InvokeNode,
|
||||
};
|
||||
|
||||
const edgeTypes = {
|
||||
|
56
web/src/pages/flow/canvas/node/invoke-node.tsx
Normal file
56
web/src/pages/flow/canvas/node/invoke-node.tsx
Normal file
@ -0,0 +1,56 @@
|
||||
import { Flex } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import { get } from 'lodash';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Handle, NodeProps, Position } from 'reactflow';
|
||||
import { NodeData } from '../../interface';
|
||||
import { LeftHandleStyle, RightHandleStyle } from './handle-icon';
|
||||
import styles from './index.less';
|
||||
import NodeHeader from './node-header';
|
||||
import NodePopover from './popover';
|
||||
|
||||
export function InvokeNode({
|
||||
id,
|
||||
data,
|
||||
isConnectable = true,
|
||||
selected,
|
||||
}: NodeProps<NodeData>) {
|
||||
const { t } = useTranslation();
|
||||
const url = get(data, 'form.url');
|
||||
return (
|
||||
<NodePopover nodeId={id}>
|
||||
<section
|
||||
className={classNames(styles.ragNode, {
|
||||
[styles.selectedNode]: selected,
|
||||
})}
|
||||
>
|
||||
<Handle
|
||||
id="c"
|
||||
type="source"
|
||||
position={Position.Left}
|
||||
isConnectable={isConnectable}
|
||||
className={styles.handle}
|
||||
style={LeftHandleStyle}
|
||||
></Handle>
|
||||
<Handle
|
||||
type="source"
|
||||
position={Position.Right}
|
||||
isConnectable={isConnectable}
|
||||
className={styles.handle}
|
||||
id="b"
|
||||
style={RightHandleStyle}
|
||||
></Handle>
|
||||
<NodeHeader
|
||||
id={id}
|
||||
name={data.name}
|
||||
label={data.label}
|
||||
className={styles.nodeHeader}
|
||||
></NodeHeader>
|
||||
<Flex vertical>
|
||||
<div>{t('flow.url')}</div>
|
||||
<div className={styles.nodeText}>{url}</div>
|
||||
</Flex>
|
||||
</section>
|
||||
</NodePopover>
|
||||
);
|
||||
}
|
@ -528,6 +528,7 @@ export const initialInvokeValues = {
|
||||
"Connection": "keep-alive"
|
||||
}`,
|
||||
proxy: 'http://',
|
||||
clean_html: false,
|
||||
};
|
||||
|
||||
export const CategorizeAnchorPointPositions = [
|
||||
@ -643,7 +644,7 @@ export const NodeMap = {
|
||||
[Operator.TuShare]: 'ragNode',
|
||||
[Operator.Note]: 'noteNode',
|
||||
[Operator.Crawler]: 'ragNode',
|
||||
[Operator.Invoke]: 'ragNode',
|
||||
[Operator.Invoke]: 'invokeNode',
|
||||
};
|
||||
|
||||
export const LanguageOptions = [
|
||||
|
@ -76,8 +76,8 @@ const FormMap = {
|
||||
[Operator.TuShare]: TuShareForm,
|
||||
[Operator.Crawler]: CrawlerForm,
|
||||
[Operator.Invoke]: InvokeForm,
|
||||
[Operator.Concentrator]: <></>,
|
||||
[Operator.Note]: <></>,
|
||||
[Operator.Concentrator]: () => <></>,
|
||||
[Operator.Note]: () => <></>,
|
||||
};
|
||||
|
||||
const EmptyContent = () => <div></div>;
|
||||
@ -135,7 +135,7 @@ const FlowDrawer = ({
|
||||
open={visible}
|
||||
getContainer={false}
|
||||
mask={false}
|
||||
width={470}
|
||||
width={500}
|
||||
closeIcon={null}
|
||||
>
|
||||
<section className={styles.formWrapper}>
|
||||
|
@ -38,7 +38,6 @@ const DynamicVariables = ({ nodeId }: IProps) => {
|
||||
title: t('key'),
|
||||
dataIndex: 'key',
|
||||
key: 'key',
|
||||
// width: 40,
|
||||
onCell: (record: IInvokeVariable) => ({
|
||||
record,
|
||||
editable: true,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Editor from '@monaco-editor/react';
|
||||
import { Form, Input, InputNumber, Select, Space } from 'antd';
|
||||
import { Form, Input, InputNumber, Select, Space, Switch } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useSetLlmSetting } from '../../hooks';
|
||||
import { IOperatorForm } from '../../interface';
|
||||
@ -63,6 +63,9 @@ const InvokeForm = ({ onValuesChange, form, node }: IOperatorForm) => {
|
||||
<Form.Item name={'proxy'} label={t('flow.proxy')}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item name={'clean_html'} label={t('flow.cleanHtml')}>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
<DynamicVariables nodeId={node?.id}></DynamicVariables>
|
||||
</Form>
|
||||
</>
|
||||
|
Loading…
x
Reference in New Issue
Block a user