perf: auto load icons (#688)

* perf: icon

* perf: icon

* doc

* perf: simple edit ui

* doc

* doc

* doc

* doc
This commit is contained in:
Archer
2024-01-03 23:51:12 +08:00
committed by GitHub
parent 2fc6e921e0
commit c2abbb579f
246 changed files with 2189 additions and 1380 deletions

View File

@@ -1,8 +1,9 @@
import { Box, Flex } from '@chakra-ui/react';
import React from 'react';
import MyIcon, { type IconName } from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import type { IconNameType } from '@fastgpt/web/components/common/Icon/type.d';
const ChatBoxDivider = ({ icon, text }: { icon: IconName; text: string }) => {
const ChatBoxDivider = ({ icon, text }: { icon: IconNameType; text: string }) => {
return (
<Box>
<Flex alignItems={'center'} py={2} gap={2}>

View File

@@ -6,7 +6,7 @@ import {
} from '@/pages/dataset/detail/components/InputDataModal';
import type { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type.d';
import NextLink from 'next/link';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { useTranslation } from 'next-i18next';
import MyTooltip from '@/components/MyTooltip';
import { useSystemStore } from '@/web/common/system/useSystemStore';

View File

@@ -22,7 +22,7 @@ import { reRankModelList } from '@/web/common/system/staticData';
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
import { DatasetSearchModeMap } from '@fastgpt/global/core/dataset/constant';
import MyRadio from '@/components/common/MyRadio';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
type DatasetParamsProps = {
searchMode: `${DatasetSearchModeEnum}`;

View File

@@ -14,7 +14,7 @@ import Avatar from '@/components/Avatar';
import type { SelectedDatasetType } from '@fastgpt/global/core/module/api.d';
import { useToast } from '@/web/common/hooks/useToast';
import MyTooltip from '@/components/MyTooltip';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constant';
import { useTranslation } from 'next-i18next';
import { useDatasetStore } from '@/web/core/dataset/store/dataset';

View File

@@ -9,7 +9,7 @@ import React, {
ForwardedRef
} from 'react';
import { Box, Flex, IconButton } from '@chakra-ui/react';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { streamFetch } from '@/web/common/api/fetch';
import MyTooltip from '@/components/MyTooltip';
import { useUserStore } from '@/web/support/user/useUserStore';
@@ -105,7 +105,7 @@ const ChatTest = (
<IconButton
className="chat"
size={'smSquare'}
icon={<MyIcon name={'clear'} w={'14px'} />}
icon={<MyIcon name={'common/clearLight'} w={'14px'} />}
variant={'whiteDanger'}
borderRadius={'md'}
aria-label={'delete'}

View File

@@ -2,7 +2,7 @@ import React from 'react';
import { BezierEdge, getBezierPath, EdgeLabelRenderer, EdgeProps } from 'reactflow';
import { onDelConnect } from '../../FlowProvider';
import { Flex } from '@chakra-ui/react';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
const ButtonEdge = (props: EdgeProps) => {
const {

View File

@@ -1,4 +1,4 @@
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import MyTooltip from '@/components/MyTooltip';
import { QuestionOutlineIcon } from '@chakra-ui/icons';
import { Box, Flex, Switch, type SwitchProps } from '@chakra-ui/react';

View File

@@ -1,4 +1,4 @@
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import MyTooltip from '@/components/MyTooltip';
import { QuestionOutlineIcon } from '@chakra-ui/icons';
import { Box, Button, Flex, ModalBody, useDisclosure, Image } from '@chakra-ui/react';

View File

@@ -27,7 +27,7 @@ import {
import { QuestionOutlineIcon, SmallAddIcon } from '@chakra-ui/icons';
import { VariableInputEnum } from '@fastgpt/global/core/module/constants';
import type { VariableItemType } from '@fastgpt/global/core/module/type.d';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { useForm } from 'react-hook-form';
import { useFieldArray } from 'react-hook-form';
import { customAlphabet } from 'nanoid';
@@ -93,10 +93,10 @@ const VariableEdit = ({
const BoxBtnStyles: BoxProps = {
cursor: 'pointer',
px: 3,
py: '2px',
py: 1,
borderRadius: 'md',
_hover: {
bg: 'myGray.200'
bg: 'myGray.150'
}
};
@@ -119,12 +119,14 @@ const VariableEdit = ({
</Box>
<Flex
{...BoxBtnStyles}
alignItems={'center'}
onClick={() => {
resetEdit({ variable: addVariable() });
onOpenEdit();
}}
>
+&ensp;{t('common.Add New')}
<SmallAddIcon />
{t('common.Add New')}
</Flex>
</Flex>
{formatVariables.length > 0 && (
@@ -152,7 +154,7 @@ const VariableEdit = ({
<Td>
<MyIcon
mr={3}
name={'settingLight'}
name={'common/settingLight'}
w={'16px'}
cursor={'pointer'}
onClick={() => {

View File

@@ -9,7 +9,7 @@ import RenderInput from '../render/RenderInput';
import type { ClassifyQuestionAgentItemType } from '@fastgpt/global/core/module/type.d';
import { customAlphabet } from 'nanoid';
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 4);
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { FlowNodeOutputTypeEnum } from '@fastgpt/global/core/module/node/constant';
import { ModuleIOValueTypeEnum, ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
import { useTranslation } from 'next-i18next';

View File

@@ -10,7 +10,7 @@ import RenderInput from '../../render/RenderInput';
import Divider from '../../modules/Divider';
import type { ContextExtractAgentItemType } from '@fastgpt/global/core/module/type';
import RenderOutput from '../../render/RenderOutput';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import ExtractFieldModal, { defaultField } from './ExtractFieldModal';
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
import { FlowNodeOutputTypeEnum } from '@fastgpt/global/core/module/node/constant';
@@ -70,7 +70,7 @@ const NodeExtract = React.memo(function NodeExtract({ data }: { data: FlowModule
<Td whiteSpace={'nowrap'}>
<MyIcon
mr={3}
name={'settingLight'}
name={'common/settingLight'}
w={'16px'}
cursor={'pointer'}
onClick={() => {

View File

@@ -11,7 +11,7 @@ import {
FlowNodeOutputTypeEnum
} from '@fastgpt/global/core/module/node/constant';
import Container from '../modules/Container';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import MyTooltip from '@/components/MyTooltip';
import SourceHandle from '../render/SourceHandle';
import type {
@@ -65,7 +65,7 @@ const NodePluginInput = React.memo(function NodePluginInput({
mb={7}
>
<MyIcon
name={'settingLight'}
name={'common/settingLight'}
w={'14px'}
cursor={'pointer'}
mr={3}

View File

@@ -11,7 +11,7 @@ import {
FlowNodeOutputTypeEnum
} from '@fastgpt/global/core/module/node/constant';
import Container from '../modules/Container';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import MyTooltip from '@/components/MyTooltip';
import TargetHandle from '../render/TargetHandle';
import { useToast } from '@/web/common/hooks/useToast';
@@ -84,7 +84,7 @@ const NodePluginOutput = React.memo(function NodePluginOutput({
</MyTooltip>
)}
<MyIcon
name={'settingLight'}
name={'common/settingLight'}
w={'14px'}
cursor={'pointer'}
ml={3}

View File

@@ -21,7 +21,7 @@ import { welcomeTextTip, variableTip } from '@fastgpt/global/core/module/templat
import { onChangeNode } from '../../FlowProvider';
import VariableEdit from '../modules/VariableEdit';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import MyTooltip from '@/components/MyTooltip';
import Container from '../modules/Container';
import NodeCard from '../render/NodeCard';
@@ -66,7 +66,7 @@ export function WelcomeText({ data }: { data: FlowModuleItemType }) {
return (
<>
<Flex mb={1} alignItems={'center'}>
<MyIcon name={'welcomeText'} mr={2} w={'16px'} color={'#E74694'} />
<MyIcon name={'core/modules/welcomeText'} mr={2} w={'16px'} color={'#E74694'} />
<Box></Box>
<MyTooltip label={welcomeTextTip} forceShow>
<QuestionOutlineIcon display={['none', 'inline']} ml={1} />

View File

@@ -8,7 +8,7 @@ import { FlowModuleItemType } from '@fastgpt/global/core/module/type.d';
import Container from '../../modules/Container';
import { VariableInputEnum, ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
import type { VariableItemType } from '@fastgpt/global/core/module/type.d';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { customAlphabet } from 'nanoid';
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
import VariableEditModal, { addVariable } from '../../modules/VariableEdit';

View File

@@ -1,6 +1,6 @@
import React, { useMemo } from 'react';
import { Box, Flex, useTheme, Menu, MenuButton, MenuList, MenuItem } from '@chakra-ui/react';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import Avatar from '@/components/Avatar';
import type { FlowModuleItemType } from '@fastgpt/global/core/module/type.d';
import MyTooltip from '@/components/MyTooltip';
@@ -116,7 +116,7 @@ const NodeCard = (props: Props) => {
},
{
icon: 'back',
icon: 'common/backLight',
label: t('common.Back'),
onClick: () => {}
}

View File

@@ -7,7 +7,7 @@ import { Box, Flex } from '@chakra-ui/react';
import MyTooltip from '@/components/MyTooltip';
import { QuestionOutlineIcon } from '@chakra-ui/icons';
import TargetHandle from '../TargetHandle';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import dynamic from 'next/dynamic';
@@ -68,7 +68,7 @@ const InputLabel = ({ moduleId, inputKey, mode, ...item }: Props) => {
{edit && (
<>
<MyIcon
name={'settingLight'}
name={'common/settingLight'}
w={'14px'}
cursor={'pointer'}
ml={3}

View File

@@ -4,7 +4,7 @@ import { onChangeNode } from '../../../../FlowProvider';
import { useTranslation } from 'next-i18next';
import { Button, useDisclosure } from '@chakra-ui/react';
import { AIChatModuleProps } from '@fastgpt/global/core/module/node/type';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import AIChatSettingsModal from '@/components/core/module/AIChatSettingsModal';
const AiSettingRender = ({ inputs = [], moduleId }: RenderInputProps) => {
@@ -27,7 +27,7 @@ const AiSettingRender = ({ inputs = [], moduleId }: RenderInputProps) => {
<>
<Button
variant={'whitePrimary'}
leftIcon={<MyIcon name={'settingLight'} w={'14px'} />}
leftIcon={<MyIcon name={'common/settingLight'} w={'14px'} />}
onClick={onOpenAIChatSetting}
>
{t('app.AI Settings')}

View File

@@ -7,7 +7,7 @@ import { DatasetSearchModeEnum } from '@fastgpt/global/core/dataset/constant';
import { FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
import { chatModelList } from '@/web/common/system/staticData';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import DatasetParamsModal from '@/components/core/module/DatasetParamsModal';
const SelectDatasetParam = ({ inputs = [], moduleId }: RenderInputProps) => {
@@ -63,7 +63,7 @@ const SelectDatasetParam = ({ inputs = [], moduleId }: RenderInputProps) => {
<>
<Button
variant={'whitePrimary'}
leftIcon={<MyIcon name={'settingLight'} w={'14px'} />}
leftIcon={<MyIcon name={'common/settingLight'} w={'14px'} />}
onClick={onOpen}
>
{t('core.dataset.search.Params Setting')}

View File

@@ -2,7 +2,7 @@ import { EditNodeFieldType, FlowNodeOutputItemType } from '@fastgpt/global/core/
import React, { useState } from 'react';
import { useTranslation } from 'next-i18next';
import { Box, Flex } from '@chakra-ui/react';
import MyIcon from '@/components/Icon';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { onChangeNode } from '../../../FlowProvider';
import MyTooltip from '@/components/MyTooltip';
import { QuestionOutlineIcon } from '@chakra-ui/icons';
@@ -37,7 +37,7 @@ const OutputLabel = ({
{edit && (
<>
<MyIcon
name={'settingLight'}
name={'common/settingLight'}
w={'14px'}
cursor={'pointer'}
mr={3}