From f7f4a8de4d2ee95f868f0873d06ae819fb0562f4 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Thu, 13 Jun 2024 23:09:36 +0800 Subject: [PATCH] feat: chat slider support folder (#1759) * feat: docker-compose version * feat: chat slider support folder * lazy behavior * pref: code sandbox size --- .../zh-cn/docs/development/upgrading/484.md | 2 +- files/docker/docker-compose-milvus.yml | 8 +- files/docker/docker-compose-pgvector.yml | 8 +- files/docker/docker-compose-zilliz.yml | 8 +- .../web/components/common/Icon/constants.ts | 1 + .../common/Icon/icons/common/select.svg | 4 + .../web/components/common/MyMenu/index.tsx | 9 +- .../web/components/common/MyPopover/index.tsx | 48 +++++++ projects/app/i18n/en/common.json | 2 + projects/app/i18n/zh/common.json | 2 + projects/app/public/docs/versionIntro.md | 21 +-- projects/app/src/components/Avatar/index.tsx | 1 - .../common/folder/SelectOneResource.tsx | 88 ++++++++----- projects/app/src/pages/api/core/app/list.ts | 26 +++- .../chat/components/ChatHistorySlider.tsx | 93 +++++++++----- .../src/pages/chat/components/SliderApps.tsx | 120 ++++++++++++++---- projects/app/src/pages/chat/index.tsx | 13 +- projects/app/src/pages/chat/team.tsx | 2 +- .../app/src/web/core/app/store/useAppStore.ts | 25 ---- projects/sandbox/src/main.ts | 7 +- 20 files changed, 336 insertions(+), 152 deletions(-) create mode 100644 packages/web/components/common/Icon/icons/common/select.svg create mode 100644 packages/web/components/common/MyPopover/index.tsx delete mode 100644 projects/app/src/web/core/app/store/useAppStore.ts diff --git a/docSite/content/zh-cn/docs/development/upgrading/484.md b/docSite/content/zh-cn/docs/development/upgrading/484.md index 7db9f8f510f..2390b0f04be 100644 --- a/docSite/content/zh-cn/docs/development/upgrading/484.md +++ b/docSite/content/zh-cn/docs/development/upgrading/484.md @@ -1,5 +1,5 @@ --- -title: 'V4.8.4(进行中)' +title: 'V4.8.4' description: 'FastGPT V4.8.4 更新说明' icon: 'upgrade' draft: false diff --git a/files/docker/docker-compose-milvus.yml b/files/docker/docker-compose-milvus.yml index a5149cbc9a2..b82848a44a1 100644 --- a/files/docker/docker-compose-milvus.yml +++ b/files/docker/docker-compose-milvus.yml @@ -114,15 +114,15 @@ services: # fastgpt sandbox: container_name: sandbox - image: ghcr.io/labring/fastgpt-sandbox:v4.8.3 # git - # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.3 # 阿里云 + image: ghcr.io/labring/fastgpt-sandbox:v4.8.4 # git + # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.4 # 阿里云 networks: - fastgpt restart: always fastgpt: container_name: fastgpt - image: ghcr.io/labring/fastgpt:v4.8.3 # git - # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.3 # 阿里云 + image: ghcr.io/labring/fastgpt:v4.8.4 # git + # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.4 # 阿里云 ports: - 3000:3000 networks: diff --git a/files/docker/docker-compose-pgvector.yml b/files/docker/docker-compose-pgvector.yml index 70c5f51c6ed..1c186bdfc22 100644 --- a/files/docker/docker-compose-pgvector.yml +++ b/files/docker/docker-compose-pgvector.yml @@ -72,15 +72,15 @@ services: # fastgpt sandbox: container_name: sandbox - image: ghcr.io/labring/fastgpt-sandbox:v4.8.3 # git - # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.3 # 阿里云 + image: ghcr.io/labring/fastgpt-sandbox:v4.8.4 # git + # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.4 # 阿里云 networks: - fastgpt restart: always fastgpt: container_name: fastgpt - image: ghcr.io/labring/fastgpt:v4.8.3 # git - # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.3 # 阿里云 + image: ghcr.io/labring/fastgpt:v4.8.4 # git + # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.4 # 阿里云 ports: - 3000:3000 networks: diff --git a/files/docker/docker-compose-zilliz.yml b/files/docker/docker-compose-zilliz.yml index 2607ce1ad34..eff1954e37c 100644 --- a/files/docker/docker-compose-zilliz.yml +++ b/files/docker/docker-compose-zilliz.yml @@ -53,15 +53,15 @@ services: wait $$! sandbox: container_name: sandbox - image: ghcr.io/labring/fastgpt-sandbox:v4.8.3 # git - # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.3 # 阿里云 + image: ghcr.io/labring/fastgpt-sandbox:v4.8.4 # git + # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.4 # 阿里云 networks: - fastgpt restart: always fastgpt: container_name: fastgpt - image: ghcr.io/labring/fastgpt:v4.8.3 # git - # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.3 # 阿里云 + image: ghcr.io/labring/fastgpt:v4.8.4 # git + # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.4 # 阿里云 ports: - 3000:3000 networks: diff --git a/packages/web/components/common/Icon/constants.ts b/packages/web/components/common/Icon/constants.ts index 10414578e46..21146d65f2d 100644 --- a/packages/web/components/common/Icon/constants.ts +++ b/packages/web/components/common/Icon/constants.ts @@ -51,6 +51,7 @@ export const iconPaths = { 'common/routePushLight': () => import('./icons/common/routePushLight.svg'), 'common/saveFill': () => import('./icons/common/saveFill.svg'), 'common/searchLight': () => import('./icons/common/searchLight.svg'), + 'common/select': () => import('./icons/common/select.svg'), 'common/selectLight': () => import('./icons/common/selectLight.svg'), 'common/settingLight': () => import('./icons/common/settingLight.svg'), 'common/text/t': () => import('./icons/common/text/t.svg'), diff --git a/packages/web/components/common/Icon/icons/common/select.svg b/packages/web/components/common/Icon/icons/common/select.svg new file mode 100644 index 00000000000..8081fb521cd --- /dev/null +++ b/packages/web/components/common/Icon/icons/common/select.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/packages/web/components/common/MyMenu/index.tsx b/packages/web/components/common/MyMenu/index.tsx index 3857dbe397e..50b3f70da07 100644 --- a/packages/web/components/common/MyMenu/index.tsx +++ b/packages/web/components/common/MyMenu/index.tsx @@ -81,7 +81,14 @@ const MyMenu = ({ }, [offset]); return ( - + { diff --git a/packages/web/components/common/MyPopover/index.tsx b/packages/web/components/common/MyPopover/index.tsx new file mode 100644 index 00000000000..60cc53144ff --- /dev/null +++ b/packages/web/components/common/MyPopover/index.tsx @@ -0,0 +1,48 @@ +import React from 'react'; +import { + Popover, + PopoverTrigger, + PopoverContent, + useDisclosure, + PlacementWithLogical +} from '@chakra-ui/react'; + +const MyPopover = ({ + Trigger, + placement, + offset, + trigger, + children +}: { + Trigger: React.ReactNode; + placement?: PlacementWithLogical; + offset?: [number, number]; + trigger?: 'hover' | 'click'; + children: (e: { onClose: () => void }) => React.ReactNode; +}) => { + const firstFieldRef = React.useRef(null); + + const { onOpen, onClose, isOpen } = useDisclosure(); + + return ( + + {Trigger} + {children({ onClose })} + + ); +}; + +export default MyPopover; diff --git a/projects/app/i18n/en/common.json b/projects/app/i18n/en/common.json index 8fa52adc57e..6258b5bfcc0 100644 --- a/projects/app/i18n/en/common.json +++ b/projects/app/i18n/en/common.json @@ -73,6 +73,7 @@ "Last use time": "Last use time", "Load Failed": "Load Failed", "Loading": "Loading...", + "More": "More", "More settings": "More settings", "Move": "Move", "MultipleRowSelect": { @@ -430,6 +431,7 @@ "Quote": "Quote", "Quote Amount": "Dataset quotes ({{amount}} items)", "Read Mark Description": "View introduction to marking function", + "Recent use": "Recent use", "Record": "Voice input", "Restart": "Restart conversation", "Select File": "Select file", diff --git a/projects/app/i18n/zh/common.json b/projects/app/i18n/zh/common.json index 30eec28d472..baa2ba504cd 100644 --- a/projects/app/i18n/zh/common.json +++ b/projects/app/i18n/zh/common.json @@ -73,6 +73,7 @@ "Last use time": "最后使用时间", "Load Failed": "加载失败", "Loading": "加载中...", + "More": "更多", "More settings": "更多设置", "Move": "移动", "MultipleRowSelect": { @@ -431,6 +432,7 @@ "Quote": "引用", "Quote Amount": "知识库引用({{amount}}条)", "Read Mark Description": "查看标注功能介绍", + "Recent use": "最近使用", "Record": "语音输入", "Restart": "重开对话", "Select File": "选择文件", diff --git a/projects/app/public/docs/versionIntro.md b/projects/app/public/docs/versionIntro.md index 39a94428908..d87f4a0860c 100644 --- a/projects/app/public/docs/versionIntro.md +++ b/projects/app/public/docs/versionIntro.md @@ -1,12 +1,17 @@ -### FastGPT V4.8.2 +### FastGPT V4.8.4 + +1. 新增 - 应用使用新权限系统。 +2. 新增 - 应用支持文件夹。 +3. 优化 - 文本分割增加连续换行、制表符清除,避免大文本性能问题。 +4. 重要修复 - 修复系统插件运行池数据污染问题,由于从内存获取,会导致全局污染。 +5. 修复 - Debug 模式下,相同 source 和 target 内容,导致连线显示异常。 +6. 修复 - 定时执行初始化错误。 +7. 修复 - 应用调用传参异常。 +8. 修复 - ctrl + cv 复杂节点时,nodeId错误。 +9. 调整组件库全局theme。 + +------ -- 新增 - 知识库重新选择向量模型重建 -- 新增 - 对话框支持问题模糊检索提示,可自定义预设问题词库 -- 新增 - js代码运行节点 -- 新增 - 外部文件源知识库: [点击查看文档](https://doc.fastai.site/docs/course/externalfile/) -- 新增 - 内容提取节点增加完全提取成功输出 -- 新增 - HTTP节点增加错误输出,可以自行判断处理 -- 优化 - 插件输入的 debug 模式,支持全量参数输入渲染 - [点击查看高级编排介绍文档](https://doc.fastgpt.in/docs/workflow/intro) - [使用文档](https://doc.fastgpt.in/docs/intro/) - [点击查看商业版](https://doc.fastgpt.in/docs/commercial/) \ No newline at end of file diff --git a/projects/app/src/components/Avatar/index.tsx b/projects/app/src/components/Avatar/index.tsx index 42a2ebcc516..88696784947 100644 --- a/projects/app/src/components/Avatar/index.tsx +++ b/projects/app/src/components/Avatar/index.tsx @@ -13,7 +13,6 @@ const Avatar = ({ w = '30px', src, ...props }: ImageProps) => { alt="" w={w} h={w} - p={'1px'} src={src || LOGO_ICON} {...props} /> diff --git a/projects/app/src/components/common/folder/SelectOneResource.tsx b/projects/app/src/components/common/folder/SelectOneResource.tsx index 13803768cb1..a0f7afc451c 100644 --- a/projects/app/src/components/common/folder/SelectOneResource.tsx +++ b/projects/app/src/components/common/folder/SelectOneResource.tsx @@ -1,5 +1,5 @@ -import React, { useState } from 'react'; -import { Box, Flex } from '@chakra-ui/react'; +import React, { useMemo, useState } from 'react'; +import { Box, BoxProps, Flex } from '@chakra-ui/react'; import { GetResourceFolderListProps, GetResourceListItemResponse, @@ -10,24 +10,43 @@ import Loading from '@fastgpt/web/components/common/MyLoading'; import Avatar from '@/components/Avatar'; import { useRequest2 } from '@fastgpt/web/hooks/useRequest'; import { useMemoizedFn } from 'ahooks'; +import { FolderImgUrl } from '@fastgpt/global/common/file/image/constants'; +import { useTranslation } from 'next-i18next'; type ResourceItemType = GetResourceListItemResponse & { open: boolean; children?: ResourceItemType[]; }; +const rootId = 'root'; + const SelectOneResource = ({ server, value, - onSelect + onSelect, + maxH = ['80vh', '600px'] }: { server: (e: GetResourceFolderListProps) => Promise; value?: ParentIdType; onSelect: (e?: string) => any; + maxH?: BoxProps['maxH']; }) => { + const { t } = useTranslation(); const [dataList, setDataList] = useState([]); const [requestingIdList, setRequestingIdList] = useState([]); + const concatRoot = useMemo(() => { + const root: ResourceItemType = { + id: rootId, + open: true, + avatar: FolderImgUrl, + name: t('common.folder.Root Path'), + isFolder: true, + children: dataList + }; + return [root]; + }, [dataList, t]); + const { runAsync: requestServer } = useRequest2((e: GetResourceFolderListProps) => { if (requestingIdList.includes(e.parentId)) return Promise.reject(null); @@ -59,7 +78,7 @@ const SelectOneResource = ({ alignItems={'center'} cursor={'pointer'} py={1} - pl={`${1.25 * index + 0.5}rem`} + pl={index === 0 ? '0.5rem' : `${1.75 * (index - 1) + 0.5}rem`} pr={2} borderRadius={'md'} _hover={{ @@ -72,6 +91,7 @@ const SelectOneResource = ({ } : { onClick: async () => { + if (item.id === rootId) return; // folder => open(request children) or close if (item.isFolder) { if (!item.children) { @@ -90,33 +110,31 @@ const SelectOneResource = ({ } })} > - 0) - ? 'visible' - : 'hidden' - } - w={'1.25rem'} - h={'1.25rem'} - cursor={'pointer'} - borderRadius={'xs'} - _hover={{ - bg: 'rgba(31, 35, 41, 0.08)' - }} - > - - + {index !== 0 && ( + + + + )} {item.name} @@ -134,7 +152,13 @@ const SelectOneResource = ({ } ); - return loading ? : ; + return loading ? ( + + ) : ( + + + + ); }; export default SelectOneResource; diff --git a/projects/app/src/pages/api/core/app/list.ts b/projects/app/src/pages/api/core/app/list.ts index a8a7d66e5b0..2e198f73c0a 100644 --- a/projects/app/src/pages/api/core/app/list.ts +++ b/projects/app/src/pages/api/core/app/list.ts @@ -16,8 +16,9 @@ import { AppTypeEnum } from '@fastgpt/global/core/app/constants'; import { AppDefaultPermissionVal } from '@fastgpt/global/support/permission/app/constant'; export type ListAppBody = { - parentId: ParentIdType; + parentId?: ParentIdType; type?: AppTypeEnum; + getRecentlyChat?: boolean; }; async function handler( @@ -35,14 +36,23 @@ async function handler( per: ReadPermissionVal }); - const { parentId, type } = req.body; + const { parentId, type, getRecentlyChat } = req.body; + + const findAppsQuery = getRecentlyChat + ? { + // get all chat app + teamId, + type: { $in: [AppTypeEnum.advanced, AppTypeEnum.simple] } + } + : { + teamId, + ...(type && { type }), + ...parseParentIdInMongo(parentId) + }; /* temp: get all apps and per */ const [myApps, rpList] = await Promise.all([ - MongoApp.find( - { teamId, ...(type && { type }), ...parseParentIdInMongo(parentId) }, - '_id avatar type name intro tmbId defaultPermission' - ) + MongoApp.find(findAppsQuery, '_id avatar type name intro tmbId defaultPermission') .sort({ updateTime: -1 }) @@ -69,7 +79,9 @@ async function handler( }) .filter((app) => app.permission.hasReadPer); - return filterApps.map((app) => ({ + const sliceApps = getRecentlyChat ? filterApps.slice(0, 15) : filterApps; + + return sliceApps.map((app) => ({ _id: app._id, avatar: app.avatar, type: app.type, diff --git a/projects/app/src/pages/chat/components/ChatHistorySlider.tsx b/projects/app/src/pages/chat/components/ChatHistorySlider.tsx index 62846d0c39e..31f9afcb90b 100644 --- a/projects/app/src/pages/chat/components/ChatHistorySlider.tsx +++ b/projects/app/src/pages/chat/components/ChatHistorySlider.tsx @@ -1,15 +1,5 @@ -import React, { useMemo, useState } from 'react'; -import { - Box, - Button, - Flex, - useTheme, - Menu, - MenuButton, - MenuList, - MenuItem, - IconButton -} from '@chakra-ui/react'; +import React, { useCallback, useMemo, useState } from 'react'; +import { Box, Button, Flex, useTheme, IconButton } from '@chakra-ui/react'; import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useEditTitle } from '@/web/common/hooks/useEditTitle'; import { useRouter } from 'next/router'; @@ -21,10 +11,15 @@ import { useConfirm } from '@fastgpt/web/hooks/useConfirm'; import Tabs from '@/components/Tabs'; import { useUserStore } from '@/web/support/user/useUserStore'; import { AppListItemType } from '@fastgpt/global/core/app/type'; -import { useQuery } from '@tanstack/react-query'; -import { TeamMemberRoleEnum } from '@fastgpt/global/support/user/team/constant'; import { useI18n } from '@/web/context/I18n'; import MyMenu from '@fastgpt/web/components/common/MyMenu'; +import SelectOneResource from '@/components/common/folder/SelectOneResource'; +import { + GetResourceFolderListProps, + GetResourceListItemResponse +} from '@fastgpt/global/common/parentFolder/type'; +import { getMyApps } from '@/web/core/app/api'; +import { AppTypeEnum } from '@fastgpt/global/core/app/constants'; type HistoryItemType = { id: string; @@ -34,6 +29,7 @@ type HistoryItemType = { }; enum TabEnum { + recently = 'recently', 'app' = 'app', 'history' = 'history' } @@ -69,6 +65,8 @@ const ChatHistorySlider = ({ }) => { const theme = useTheme(); const router = useRouter(); + const isTeamChat = router.pathname === '/chat/team'; + const { t } = useTranslation(); const { appT } = useI18n(); @@ -78,6 +76,7 @@ const ChatHistorySlider = ({ const [currentTab, setCurrentTab] = useState<`${TabEnum}`>(TabEnum.history); const showApps = apps?.length > 0; + // custom title edit const { onOpenModal, EditModal: EditTitleModal } = useEditTitle({ title: t('core.chat.Custom History Title'), @@ -96,17 +95,33 @@ const ChatHistorySlider = ({ [activeChatId, history, t] ); - useQuery(['init'], () => { - if (!showApps) { - setCurrentTab(TabEnum.history); - return null; - } - return; - }); - const canRouteToDetail = useMemo( - () => appId && userInfo?.team.role !== TeamMemberRoleEnum.visitor, - [appId, userInfo?.team.role] + () => appId && userInfo?.team.permission.hasWritePer, + [appId, userInfo?.team.permission.hasWritePer] + ); + + const getAppList = useCallback(async ({ parentId }: GetResourceFolderListProps) => { + return getMyApps({ parentId }).then((res) => + res.map((item) => ({ + id: item._id, + name: item.name, + avatar: item.avatar, + isFolder: item.type === AppTypeEnum.folder + })) + ); + }, []); + + const onChangeApp = useCallback( + (appId: string) => { + router.replace({ + query: { + ...router.query, + chatId: '', + appId + } + }); + }, + [router] ); return ( @@ -148,10 +163,11 @@ const ChatHistorySlider = ({ {!isPc && appId && ( )} - {currentTab === TabEnum.app && !isPc && ( + {currentTab === TabEnum.recently && !isPc && ( <> {Array.isArray(apps) && apps.map((item) => ( @@ -309,12 +325,7 @@ const ChatHistorySlider = ({ } : { onClick: () => { - router.replace({ - query: { - ...router.query, - appId: item._id - } - }); + onChangeApp(item._id); onClose(); } })} @@ -327,9 +338,23 @@ const ChatHistorySlider = ({ ))} )} + {currentTab === TabEnum.app && !isPc && ( + <> + { + if (!id) return; + onChangeApp(id); + onClose(); + }} + server={getAppList} + /> + + )} - {!isPc && appId && ( + {/* exec */} + {!isPc && appId && !isTeamChat && ( { +const SliderApps = ({ apps, activeAppId }: { apps: AppListItemType[]; activeAppId: string }) => { const { t } = useTranslation(); const router = useRouter(); + const isTeamChat = router.pathname === '/chat/team'; + + const getAppList = useCallback(async ({ parentId }: GetResourceFolderListProps) => { + return getMyApps({ parentId }).then((res) => + res.map((item) => ({ + id: item._id, + name: item.name, + avatar: item.avatar, + isFolder: item.type === AppTypeEnum.folder + })) + ); + }, []); + + const onChangeApp = useCallback( + (appId: string) => { + router.replace({ + query: { + ...router.query, + chatId: '', + appId + } + }); + }, + [router] + ); return ( - - {showExist && ( + + {!isTeamChat && ( } + icon={} bg={'white'} boxShadow={'1px 1px 9px rgba(0,0,0,0.15)'} size={'smSquare'} @@ -45,7 +71,58 @@ const SliderApps = ({ )} - + {!isTeamChat && ( + <> + + + {t('core.chat.Recent use')} + + {t('common.More')} + + + + } + > + {({ onClose }) => ( + + { + if (!id) return; + onChangeApp(id); + onClose(); + }} + server={getAppList} + /> + + )} + + + )} + + {apps.map((item) => ( { - router.replace({ - query: { - ...router.query, - chatId: '', - appId: item._id - } - }); - } + onClick: () => onChangeApp(item._id) })} > diff --git a/projects/app/src/pages/chat/index.tsx b/projects/app/src/pages/chat/index.tsx index e06fa8d2168..dddd25f6554 100644 --- a/projects/app/src/pages/chat/index.tsx +++ b/projects/app/src/pages/chat/index.tsx @@ -32,11 +32,12 @@ import ChatHeader from './components/ChatHeader'; import { getErrText } from '@fastgpt/global/common/error/utils'; import { useUserStore } from '@/web/support/user/useUserStore'; import { serviceSideProps } from '@/web/common/utils/i18n'; -import { useAppStore } from '@/web/core/app/store/useAppStore'; import { checkChatSupportSelectFileByChatModels } from '@/web/core/chat/utils'; import { getChatTitleFromChatMessage } from '@fastgpt/global/core/chat/utils'; import { ChatStatusEnum } from '@fastgpt/global/core/chat/constants'; import { GPTMessages2Chats } from '@fastgpt/global/core/chat/adapt'; +import { getMyApps } from '@/web/core/app/api'; +import { useRequest2 } from '@fastgpt/web/hooks/useRequest'; const Chat = ({ appId, chatId }: { appId: string; chatId: string }) => { const router = useRouter(); @@ -62,7 +63,6 @@ const Chat = ({ appId, chatId }: { appId: string; chatId: string }) => { setChatData, delOneHistoryItem } = useChatStore(); - const { myApps, loadMyApps } = useAppStore(); const { userInfo } = useUserStore(); const { isPc } = useSystemStore(); @@ -128,7 +128,12 @@ const Chat = ({ appId, chatId }: { appId: string; chatId: string }) => { [appId, chatId, histories, pushHistory, router, setChatData, updateHistory] ); - useQuery(['loadModels'], () => loadMyApps()); + const { data: myApps = [], runAsync: loadMyApps } = useRequest2( + () => getMyApps({ getRecentlyChat: true }), + { + manual: false + } + ); // get chat app info const loadChatInfo = useCallback( @@ -272,7 +277,7 @@ const Chat = ({ appId, chatId }: { appId: string; chatId: string }) => { onClose={onCloseSlider} > - {children} + {children} ); })( diff --git a/projects/app/src/pages/chat/team.tsx b/projects/app/src/pages/chat/team.tsx index ee8954cf3bc..5c5d866e0e7 100644 --- a/projects/app/src/pages/chat/team.tsx +++ b/projects/app/src/pages/chat/team.tsx @@ -274,7 +274,7 @@ const OutLink = () => { {/* pc show myself apps */} {isPc && ( - + )} diff --git a/projects/app/src/web/core/app/store/useAppStore.ts b/projects/app/src/web/core/app/store/useAppStore.ts deleted file mode 100644 index eb617443e9b..00000000000 --- a/projects/app/src/web/core/app/store/useAppStore.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { create } from 'zustand'; -import { devtools } from 'zustand/middleware'; -import { immer } from 'zustand/middleware/immer'; -import { getMyApps } from '@/web/core/app/api'; -import { AppListItemType } from '@fastgpt/global/core/app/type'; - -export type State = { - myApps: AppListItemType[]; - loadMyApps: (...arg: Parameters) => Promise; -}; - -export const useAppStore = create()( - devtools( - immer((set, get) => ({ - myApps: [], - async loadMyApps(data) { - const res = await getMyApps(data); - set((state) => { - state.myApps = res; - }); - return res; - } - })) - ) -); diff --git a/projects/sandbox/src/main.ts b/projects/sandbox/src/main.ts index 5f5887629e0..a8d7d069d3b 100644 --- a/projects/sandbox/src/main.ts +++ b/projects/sandbox/src/main.ts @@ -6,7 +6,12 @@ import { HttpExceptionFilter } from './http-exception.filter'; import { ResponseInterceptor } from './response'; async function bootstrap(port: number) { - const app = await NestFactory.create(AppModule, new FastifyAdapter()); + const app = await NestFactory.create( + AppModule, + new FastifyAdapter({ + bodyLimit: 50 * 1048576 // 50MB + }) + ); // 使用全局异常过滤器 app.useGlobalFilters(new HttpExceptionFilter());