feat: add custom edge (#1061)

### What problem does this PR solve?
feat: add custom edge
feat: add flow card
feat: add store for canvas
#918 

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-06-05 10:46:06 +08:00
committed by GitHub
parent b8eedbdd86
commit 39ac3b1e60
42 changed files with 1559 additions and 387 deletions

View File

@ -1,16 +1,12 @@
import {
LlmModelType,
ModelVariableType,
settledModelVariableMap,
} from '@/constants/knowledge';
import { Divider, Flex, Form, InputNumber, Select, Slider, Switch } from 'antd';
import classNames from 'classnames';
import camelCase from 'lodash/camelCase';
import { useEffect } from 'react';
import { ISegmentedContentProps } from '../interface';
import { useTranslate } from '@/hooks/commonHooks';
import { useSelectLlmOptionsByModelType } from '@/hooks/llmHooks';
import LlmSettingItems from '@/components/llm-setting-items';
import { Variable } from '@/interfaces/database/chat';
import { variableEnabledFieldMap } from '../constants';
import styles from './index.less';
@ -24,14 +20,6 @@ const ModelSetting = ({
initialLlmSetting?: Variable;
visible?: boolean;
}) => {
const { t } = useTranslate('chat');
const parameterOptions = Object.values(ModelVariableType).map((x) => ({
label: t(camelCase(x)),
value: x,
}));
const modelOptions = useSelectLlmOptionsByModelType();
const handleParametersChange = (value: ModelVariableType) => {
const variable = settledModelVariableMap[value];
form.setFieldsValue({ llm_setting: variable });
@ -62,7 +50,13 @@ const ModelSetting = ({
[styles.segmentedHidden]: !show,
})}
>
<Form.Item
{visible && (
<LlmSettingItems
prefix="llm_setting"
handleParametersChange={handleParametersChange}
></LlmSettingItems>
)}
{/* <Form.Item
label={t('model')}
name="llm_id"
tooltip={t('modelTip')}
@ -279,7 +273,7 @@ const ModelSetting = ({
}}
</Form.Item>
</Flex>
</Form.Item>
</Form.Item> */}
</section>
);
};