Perf: vector queue and app ui (#1750)
This commit is contained in:
35
projects/app/src/components/core/app/TypeTag.tsx
Normal file
35
projects/app/src/components/core/app/TypeTag.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import React, { useRef } from 'react';
|
||||
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
|
||||
import MyTag from '@fastgpt/web/components/common/Tag/index';
|
||||
import { useI18n } from '@/web/context/I18n';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { Box } from '@chakra-ui/react';
|
||||
|
||||
const AppTypeTag = ({ type }: { type: AppTypeEnum }) => {
|
||||
const { appT } = useI18n();
|
||||
|
||||
const map = useRef({
|
||||
[AppTypeEnum.simple]: {
|
||||
label: appT('type.Simple bot'),
|
||||
icon: 'core/app/type/simple'
|
||||
},
|
||||
[AppTypeEnum.advanced]: {
|
||||
label: appT('type.Workflow bot'),
|
||||
icon: 'core/app/type/workflow'
|
||||
},
|
||||
[AppTypeEnum.folder]: undefined
|
||||
});
|
||||
|
||||
const data = map.current[type];
|
||||
|
||||
return data ? (
|
||||
<MyTag type="borderFill" colorSchema="gray">
|
||||
<MyIcon name={data.icon as any} w={'0.8rem'} color={'myGray.500'} />
|
||||
<Box ml={1} fontSize={'mini'}>
|
||||
{data.label}
|
||||
</Box>
|
||||
</MyTag>
|
||||
) : null;
|
||||
};
|
||||
|
||||
export default AppTypeTag;
|
||||
@@ -48,19 +48,22 @@ export const useKeyboard = () => {
|
||||
// filter workflow data
|
||||
const newNodes = parseData
|
||||
.filter((item) => !!item.type && item.data?.unique !== true)
|
||||
.map((item) => ({
|
||||
// reset id
|
||||
...item,
|
||||
id: getNanoid(),
|
||||
data: {
|
||||
...item.data,
|
||||
nodeId: getNanoid()
|
||||
},
|
||||
position: {
|
||||
x: item.position.x + 100,
|
||||
y: item.position.y + 100
|
||||
}
|
||||
}));
|
||||
.map((item) => {
|
||||
const nodeId = getNanoid();
|
||||
return {
|
||||
// reset id
|
||||
...item,
|
||||
id: nodeId,
|
||||
data: {
|
||||
...item.data,
|
||||
nodeId
|
||||
},
|
||||
position: {
|
||||
x: item.position.x + 100,
|
||||
y: item.position.y + 100
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
setNodes((prev) =>
|
||||
prev
|
||||
|
||||
@@ -144,7 +144,7 @@ export const useReference = ({
|
||||
.filter((item) => item.children.length > 0);
|
||||
|
||||
return list;
|
||||
}, [edges, nodeId, nodeList, t, valueType]);
|
||||
}, [appDetail.chatConfig, edges, nodeId, nodeList, t, valueType]);
|
||||
|
||||
const formatValue = useMemo(() => {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user