diff --git a/projects/app/src/pageComponents/chat/ChatTeamApp/List.tsx b/projects/app/src/pageComponents/chat/ChatTeamApp/List.tsx index 3a119a9a4..98fb90c69 100644 --- a/projects/app/src/pageComponents/chat/ChatTeamApp/List.tsx +++ b/projects/app/src/pageComponents/chat/ChatTeamApp/List.tsx @@ -8,7 +8,7 @@ import { useTranslation } from 'next-i18next'; import MyBox from '@fastgpt/web/components/common/MyBox'; import { useContextSelector } from 'use-context-selector'; import { AppListContext } from '@/pageComponents/dashboard/agent/context'; -import { AppTypeEnum } from '@fastgpt/global/core/app/constants'; +import { AppTypeEnum, ToolTypeList } from '@fastgpt/global/core/app/constants'; import MyTooltip from '@fastgpt/web/components/common/MyTooltip'; import AppTypeTag from '@/pageComponents/chat/ChatTeamApp/TypeTag'; @@ -18,7 +18,7 @@ import UserBox from '@fastgpt/web/components/common/UserBox'; import { ChatSettingContext } from '@/web/core/chat/context/chatSettingContext'; import { ChatSidebarPaneEnum } from '@/pageComponents/chat/constants'; -const ListItem = ({ appType }: { appType: AppTypeEnum | 'all' }) => { +const List = ({ appType }: { appType: AppTypeEnum | 'all' }) => { const { t } = useTranslation(); const router = useRouter(); const { isPc } = useSystem(); @@ -26,15 +26,11 @@ const ListItem = ({ appType }: { appType: AppTypeEnum | 'all' }) => { const myApps = useContextSelector(AppListContext, (v) => v.myApps.filter( (app) => - appType === app.type || - app.type === AppTypeEnum.folder || - (appType === 'all' && - [ - AppTypeEnum.folder, - AppTypeEnum.simple, - AppTypeEnum.workflow, - AppTypeEnum.workflowTool - ].includes(app.type)) + appType === 'all' || + [ + appType, + ToolTypeList.includes(appType) ? AppTypeEnum.toolFolder : AppTypeEnum.folder + ].includes(app.type) ) ); const handlePaneChange = useContextSelector(ChatSettingContext, (v) => v.handlePaneChange); @@ -150,4 +146,4 @@ const ListItem = ({ appType }: { appType: AppTypeEnum | 'all' }) => { ); }; -export default ListItem; +export default List; diff --git a/projects/app/src/pageComponents/dashboard/Container.tsx b/projects/app/src/pageComponents/dashboard/Container.tsx index c4b4b3f68..3b2f6d73d 100644 --- a/projects/app/src/pageComponents/dashboard/Container.tsx +++ b/projects/app/src/pageComponents/dashboard/Container.tsx @@ -339,7 +339,9 @@ const DashboardContainer = ({ ); })} - + + + )} diff --git a/projects/app/src/pageComponents/dashboard/agent/context.tsx b/projects/app/src/pageComponents/dashboard/agent/context.tsx index 42b2da2d9..ff370b4f8 100644 --- a/projects/app/src/pageComponents/dashboard/agent/context.tsx +++ b/projects/app/src/pageComponents/dashboard/agent/context.tsx @@ -72,12 +72,27 @@ const AppListContextProvider = ({ children }: { children: ReactNode }) => { loading: isFetchingApps } = useRequest2( () => { - const isAgent = router.pathname.includes('/agent'); - const formatType = isAgent - ? !type || type === 'all' - ? [AppTypeEnum.folder, AppTypeEnum.simple, AppTypeEnum.workflow] - : [AppTypeEnum.folder, type] - : !type || type === 'all' + const formatType = (() => { + // chat page show all apps + if (router.pathname.includes('/chat')) { + return [ + AppTypeEnum.folder, + AppTypeEnum.toolFolder, + AppTypeEnum.simple, + AppTypeEnum.workflow, + AppTypeEnum.workflowTool + ]; + } + + // agent page + if (router.pathname.includes('/agent')) { + return !type || type === 'all' + ? [AppTypeEnum.folder, AppTypeEnum.simple, AppTypeEnum.workflow] + : [AppTypeEnum.folder, type]; + } + + // tool page + return !type || type === 'all' ? [ AppTypeEnum.toolFolder, AppTypeEnum.workflowTool, @@ -85,6 +100,8 @@ const AppListContextProvider = ({ children }: { children: ReactNode }) => { AppTypeEnum.httpToolSet ] : [AppTypeEnum.toolFolder, type]; + })(); + return getMyApps({ parentId, type: formatType, searchKey }); }, {