fix: allow home chat file uploads

This commit is contained in:
xqvvu
2026-04-28 16:40:07 +08:00
parent 99156128fa
commit 1ba6c81df5
2 changed files with 21 additions and 7 deletions
@@ -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 (
<WorkflowRuntimeContextProvider
appId={appId}
chatId={chatId}
outLinkAuthData={formatOutLinkAuth}
runtimeFileSelectConfig={chatType === ChatTypeEnumValue.test ? fileSelectConfig : undefined}
runtimeFileSelectConfig={runtimeFileSelectConfig}
>
<ChatBoxContext.Provider value={value}>{children}</ChatBoxContext.Provider>
</WorkflowRuntimeContextProvider>
@@ -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<CreatePostPresignedUrlResponseType> {
const { filename, appId, chatId, outLinkAuthData, fileSelectConfig } =
@@ -31,12 +32,16 @@ async function handler(req: ApiRequestProps): Promise<CreatePostPresignedUrlResp
]);
const effectiveFileSelectConfig = fileSelectConfig
? await (async () => {
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;