From 1ba6c81df5519dee20b3a3da47bde062e50293cc Mon Sep 17 00:00:00 2001 From: xqvvu Date: Tue, 28 Apr 2026 16:40:07 +0800 Subject: [PATCH] fix: allow home chat file uploads --- .../chat/ChatContainer/ChatBox/Provider.tsx | 11 ++++++++++- .../core/chat/file/presignChatFilePostUrl.ts | 17 +++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/projects/app/src/components/core/chat/ChatContainer/ChatBox/Provider.tsx b/projects/app/src/components/core/chat/ChatContainer/ChatBox/Provider.tsx index f766ac11de..e0dce145fe 100644 --- a/projects/app/src/components/core/chat/ChatContainer/ChatBox/Provider.tsx +++ b/projects/app/src/components/core/chat/ChatContainer/ChatBox/Provider.tsx @@ -254,13 +254,22 @@ const Provider = ({ getHistoryResponseData, chatType }; + const runtimeFileSelectConfig = useMemo(() => { + if (chatType === ChatTypeEnumValue.test) { + return fileSelectConfig; + } + if (chatType === ChatTypeEnumValue.home && !props.currentQuickAppId) { + return fileSelectConfig; + } + return undefined; + }, [chatType, fileSelectConfig, props.currentQuickAppId]); return ( {children} diff --git a/projects/app/src/pages/api/core/chat/file/presignChatFilePostUrl.ts b/projects/app/src/pages/api/core/chat/file/presignChatFilePostUrl.ts index 8c63046b3f..cf5a14e593 100644 --- a/projects/app/src/pages/api/core/chat/file/presignChatFilePostUrl.ts +++ b/projects/app/src/pages/api/core/chat/file/presignChatFilePostUrl.ts @@ -12,6 +12,7 @@ import { getTeamPlanStatus } from '@fastgpt/service/support/wallet/sub/utils'; import { authApp } from '@fastgpt/service/support/permission/app/auth'; import { WritePermissionVal } from '@fastgpt/global/support/permission/constant'; import { S3ErrEnum } from '@fastgpt/global/common/error/code/s3'; +import { MongoChatSetting } from '@fastgpt/service/core/chat/setting/schema'; async function handler(req: ApiRequestProps): Promise { const { filename, appId, chatId, outLinkAuthData, fileSelectConfig } = @@ -31,12 +32,16 @@ async function handler(req: ApiRequestProps): Promise { - await authApp({ - req, - authToken: true, - appId, - per: WritePermissionVal - }); + const isHomeApp = await MongoChatSetting.exists({ teamId, appId }); + + if (!isHomeApp) { + await authApp({ + req, + authToken: true, + appId, + per: WritePermissionVal + }); + } return fileSelectConfig; })() : app?.chatConfig?.fileSelectConfig;