mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
fix: ts数据
This commit is contained in:
@@ -35,8 +35,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
pageSize,
|
pageSize,
|
||||||
data: dataItems,
|
data: dataItems,
|
||||||
total: await DataItem.countDocuments({
|
total: await DataItem.countDocuments({
|
||||||
dataId,
|
dataId
|
||||||
status: 0
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -9,6 +9,7 @@ import { getUserOpenaiKey } from '@/service/utils/tools';
|
|||||||
import { OpenAiTuneStatusEnum } from '@/service/constants/training';
|
import { OpenAiTuneStatusEnum } from '@/service/constants/training';
|
||||||
import { sendTrainSucceed } from '@/service/utils/sendEmail';
|
import { sendTrainSucceed } from '@/service/utils/sendEmail';
|
||||||
import { httpsAgent } from '@/service/utils/tools';
|
import { httpsAgent } from '@/service/utils/tools';
|
||||||
|
import { ModelPopulate } from '@/types/mongoSchema';
|
||||||
|
|
||||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
if (req.headers.auth !== 'archer') {
|
if (req.headers.auth !== 'archer') {
|
||||||
@@ -31,7 +32,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
// 删除训练文件
|
// 删除训练文件
|
||||||
openai.deleteFile(data.training_files[0].id, { httpsAgent });
|
openai.deleteFile(data.training_files[0].id, { httpsAgent });
|
||||||
|
|
||||||
const model = await Model.findById(item.modelId).populate({
|
const model = await Model.findById<ModelPopulate>(item.modelId).populate({
|
||||||
path: 'userId',
|
path: 'userId',
|
||||||
options: {
|
options: {
|
||||||
strictPopulate: false
|
strictPopulate: false
|
||||||
|
@@ -46,6 +46,10 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
|||||||
// 根据 id 获取用户信息
|
// 根据 id 获取用户信息
|
||||||
const user = await User.findById(response._id);
|
const user = await User.findById(response._id);
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
throw new Error('获取用户信息异常');
|
||||||
|
}
|
||||||
|
|
||||||
jsonRes(res, {
|
jsonRes(res, {
|
||||||
data: {
|
data: {
|
||||||
token: generateToken(user._id),
|
token: generateToken(user._id),
|
||||||
|
@@ -44,6 +44,10 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
|||||||
email
|
email
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
throw new Error('获取用户信息异常');
|
||||||
|
}
|
||||||
|
|
||||||
jsonRes(res, {
|
jsonRes(res, {
|
||||||
data: {
|
data: {
|
||||||
token: generateToken(user._id),
|
token: generateToken(user._id),
|
||||||
|
Reference in New Issue
Block a user