v4.6.6-fix (#676)

This commit is contained in:
Archer
2024-01-02 14:18:51 +08:00
committed by GitHub
parent d645a7406b
commit 2e75851b02
179 changed files with 279 additions and 5964 deletions

View File

@@ -2,7 +2,7 @@ import type { NextApiRequest, NextApiResponse } from 'next';
import { jsonRes } from '@fastgpt/service/common/response';
import { authCert } from '@fastgpt/service/support/permission/auth/common';
import { withNextCors } from '@fastgpt/service/common/middle/cors';
import { getUploadModel } from '@fastgpt/service/common/file/upload/multer';
import { getUploadModel, removeFilesByPaths } from '@fastgpt/service/common/file/upload/multer';
import fs from 'fs';
import { getAIApi } from '@fastgpt/service/core/ai/config';
import { pushWhisperBill } from '@/service/support/wallet/bill/push';
@@ -12,12 +12,16 @@ const upload = getUploadModel({
});
export default withNextCors(async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
let filePaths: string[] = [];
try {
const {
files,
metadata: { duration, shareId }
} = await upload.doUpload<{ duration: number; shareId?: string }>(req, res);
filePaths = files.map((file) => file.path);
const { teamId, tmbId } = await authCert({ req, authToken: true });
if (!global.whisperModel) {
@@ -53,6 +57,8 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
error: err
});
}
removeFilesByPaths(filePaths);
});
export const config = {