Commit e289c4ec by archer

fix: ts数据

parent 1cbcc624
......@@ -35,8 +35,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
pageSize,
data: dataItems,
total: await DataItem.countDocuments({
dataId,
status: 0
dataId
})
}
});
......
......@@ -9,6 +9,7 @@ import { getUserOpenaiKey } from '@/service/utils/tools';
import { OpenAiTuneStatusEnum } from '@/service/constants/training';
import { sendTrainSucceed } from '@/service/utils/sendEmail';
import { httpsAgent } from '@/service/utils/tools';
import { ModelPopulate } from '@/types/mongoSchema';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
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 });
const model = await Model.findById(item.modelId).populate({
const model = await Model.findById<ModelPopulate>(item.modelId).populate({
path: 'userId',
options: {
strictPopulate: false
......
......@@ -46,6 +46,10 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
// 根据 id 获取用户信息
const user = await User.findById(response._id);
if (!user) {
throw new Error('获取用户信息异常');
}
jsonRes(res, {
data: {
token: generateToken(user._id),
......
......@@ -44,6 +44,10 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
email
});
if (!user) {
throw new Error('获取用户信息异常');
}
jsonRes(res, {
data: {
token: generateToken(user._id),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment