import { useSystemStore } from '@/web/common/system/useSystemStore'; import { Box, Flex, HStack, ModalBody } from '@chakra-ui/react'; import Avatar from '@fastgpt/web/components/common/Avatar'; import MyBox from '@fastgpt/web/components/common/MyBox'; import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import MyIcon from '@fastgpt/web/components/common/Icon'; import MyModal from '@fastgpt/web/components/common/MyModal'; import Markdown from '@/components/Markdown'; import { NodeTemplateListItemType } from '@fastgpt/global/core/workflow/type/node'; import { PluginGroupSchemaType } from '@fastgpt/service/core/app/plugin/type'; const PluginCard = ({ item, groups }: { item: NodeTemplateListItemType; groups: PluginGroupSchemaType[]; }) => { const { t } = useTranslation(); const { feConfigs } = useSystemStore(); const [currentPlugin, setCurrentPlugin] = useState(null); const type = groups.reduce((acc, group) => { const foundType = group.groupTypes.find((type) => type.typeId === item.templateType); return foundType ? foundType.typeName : acc; }, undefined); return ( {item.name} {t(type as any)} {item.intro || t('app:templateMarket.no_intro')} {item.instructions && ( setCurrentPlugin(item)} _hover={{ bg: 'myGray.100' }} > {t('app:plugin.Instructions')} )} {`by ${item.author || feConfigs.systemTitle}`} {currentPlugin && ( setCurrentPlugin(null)} /> )} ); }; const InstructionModal = ({ currentPlugin, onClose }: { currentPlugin: NodeTemplateListItemType; onClose: () => void; }) => { return ( ); }; export default React.memo(PluginCard);