perf: 去除冗余代码
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
import { Schema, model, models, Model } from 'mongoose';
|
||||
import { DataSchema as Datatype } from '@/types/mongoSchema';
|
||||
import { DataTypeTextMap } from '@/constants/data';
|
||||
|
||||
const DataSchema = new Schema({
|
||||
userId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'user',
|
||||
required: true
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
createTime: {
|
||||
type: Date,
|
||||
default: () => new Date()
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: true,
|
||||
enum: Object.keys(DataTypeTextMap)
|
||||
},
|
||||
isDeleted: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
|
||||
export const Data: Model<Datatype> = models['data'] || model('data', DataSchema);
|
||||
@@ -1,69 +0,0 @@
|
||||
import type { DataItemSchema as DataItemType } from '@/types/mongoSchema';
|
||||
import { Schema, model, models, Model } from 'mongoose';
|
||||
import { DataTypeTextMap } from '@/constants/data';
|
||||
|
||||
const DataItemSchema = new Schema({
|
||||
userId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'user',
|
||||
required: true
|
||||
},
|
||||
dataId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'data',
|
||||
required: true
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: true,
|
||||
enum: Object.keys(DataTypeTextMap)
|
||||
},
|
||||
times: {
|
||||
// 剩余重试次数
|
||||
type: Number,
|
||||
default: 3
|
||||
},
|
||||
text: {
|
||||
// 文本内容
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
rawResponse: {
|
||||
// 原始拆分结果
|
||||
type: [String],
|
||||
default: []
|
||||
},
|
||||
result: {
|
||||
type: [
|
||||
{
|
||||
q: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
a: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
abstract: {
|
||||
// 摘要
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
abstractVector: {
|
||||
// 摘要对应的向量
|
||||
type: [Number],
|
||||
default: []
|
||||
}
|
||||
}
|
||||
],
|
||||
default: []
|
||||
},
|
||||
status: {
|
||||
// 0-闲置,1-待生成,2-生成中
|
||||
type: Number,
|
||||
default: 1
|
||||
}
|
||||
});
|
||||
|
||||
export const DataItem: Model<DataItemType> =
|
||||
models['dataItem'] || model('dataItem', DataItemSchema);
|
||||
@@ -21,11 +21,6 @@ const ModelSchema = new Schema({
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
intro: {
|
||||
// 模型介绍
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
status: {
|
||||
type: String,
|
||||
required: true,
|
||||
@@ -35,10 +30,6 @@ const ModelSchema = new Schema({
|
||||
type: Date,
|
||||
default: () => new Date()
|
||||
},
|
||||
trainingTimes: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
temperature: {
|
||||
type: Number,
|
||||
min: 0,
|
||||
@@ -53,11 +44,6 @@ const ModelSchema = new Schema({
|
||||
}
|
||||
},
|
||||
service: {
|
||||
trainId: {
|
||||
// 训练时需要的 ID, 不能训练的模型没有这个值。
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
chatModel: {
|
||||
// 聊天时使用的模型
|
||||
type: String,
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { Schema, model, models, Model } from 'mongoose';
|
||||
import { TrainingSchema as TrainingType } from '@/types/mongoSchema';
|
||||
const TrainingSChema = new Schema({
|
||||
serviceName: {
|
||||
// 模型厂商名
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
tuneId: {
|
||||
// 微调进程 ID
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
modelId: {
|
||||
// 关联模型的 ID
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'model',
|
||||
required: true
|
||||
},
|
||||
status: {
|
||||
// 状态值
|
||||
type: String,
|
||||
required: true,
|
||||
enum: ['pending', 'succeed', 'errored', 'canceled']
|
||||
}
|
||||
});
|
||||
|
||||
export const Training: Model<TrainingType> =
|
||||
models['training'] || model('training', TrainingSChema);
|
||||
Reference in New Issue
Block a user