mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00

* feat: undo-redo & edit snapshots * fix merge * add simple history back * fix some undo * change app latest version * fix * chatconfig * fix snapshot * fix * fix * fix * fix compare * fix initial * fix merge: * fix useEffect * fix snapshot initial and saved state * chore * fix * compare snapshot * nodes edges useEffct * fix chatconfig * fix * delete unused method * fix * fix * fix * default version name
51 lines
1004 B
TypeScript
51 lines
1004 B
TypeScript
import { connectionMongo, getMongoModel, type Model } from '../../../common/mongo';
|
|
const { Schema, model, models } = connectionMongo;
|
|
import { AppVersionSchemaType } from '@fastgpt/global/core/app/version';
|
|
import { chatConfigType } from '../schema';
|
|
|
|
export const AppVersionCollectionName = 'app_versions';
|
|
|
|
const AppVersionSchema = new Schema({
|
|
appId: {
|
|
type: Schema.Types.ObjectId,
|
|
ref: AppVersionCollectionName,
|
|
required: true
|
|
},
|
|
time: {
|
|
type: Date,
|
|
default: () => new Date()
|
|
},
|
|
nodes: {
|
|
type: Array,
|
|
default: []
|
|
},
|
|
edges: {
|
|
type: Array,
|
|
default: []
|
|
},
|
|
chatConfig: {
|
|
type: chatConfigType
|
|
},
|
|
isPublish: {
|
|
type: Boolean
|
|
},
|
|
versionName: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
tmbId: {
|
|
type: String
|
|
}
|
|
});
|
|
|
|
try {
|
|
AppVersionSchema.index({ appId: 1, time: -1 });
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|
|
|
|
export const MongoAppVersion = getMongoModel<AppVersionSchemaType>(
|
|
AppVersionCollectionName,
|
|
AppVersionSchema
|
|
);
|