mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-16 01:09:01 +08:00
36d1ff3679
* perf: faq * index * delete dataset * delete dataset * perf: delete dataset * init * fix: faq * doc * fix: share link auth (#6063) * standard plan add custom domain config (#6061) * standard plan add custom domain config * bill detail modal * perf: vector count api * feat: custom domain & wecom bot SaaS integration (#6047) * feat: custom Domain type define * feat: custom domain * feat: wecom custom domain * chore: i18n * chore: i18n; team auth * feat: wecom multi-model message support * chore: wecom edit modal * chore(doc): custom domain && wecom bot * fix: type * fix: type * fix: file detect * feat: fe * fix: img name * fix: test * compress img * rename * editor initial status * fix: chat url * perf: s3 upload by buffer * img * refresh * fix: custom domain selector (#6069) * empty tip * perf: s3 init * sort provider * fix: extend * perf: extract filename --------- Co-authored-by: Roy <whoeverimf5@gmail.com> Co-authored-by: heheer <heheer@sealos.io> Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
143 lines
2.8 KiB
TypeScript
143 lines
2.8 KiB
TypeScript
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
|
|
import { Schema, getMongoModel } from '../../common/mongo';
|
|
import type { AppSchema as AppType } from '@fastgpt/global/core/app/type.d';
|
|
import {
|
|
TeamCollectionName,
|
|
TeamMemberCollectionName
|
|
} from '@fastgpt/global/support/user/team/constant';
|
|
|
|
export const AppCollectionName = 'apps';
|
|
|
|
export const chatConfigType = {
|
|
welcomeText: String,
|
|
variables: Array,
|
|
questionGuide: Object,
|
|
ttsConfig: Object,
|
|
whisperConfig: Object,
|
|
scheduledTriggerConfig: Object,
|
|
chatInputGuide: Object,
|
|
fileSelectConfig: Object,
|
|
instruction: String,
|
|
autoExecute: Object
|
|
};
|
|
|
|
// schema
|
|
const AppSchema = new Schema(
|
|
{
|
|
parentId: {
|
|
type: Schema.Types.ObjectId,
|
|
ref: AppCollectionName,
|
|
default: null
|
|
},
|
|
teamId: {
|
|
type: Schema.Types.ObjectId,
|
|
ref: TeamCollectionName,
|
|
required: true
|
|
},
|
|
tmbId: {
|
|
type: Schema.Types.ObjectId,
|
|
ref: TeamMemberCollectionName,
|
|
required: true
|
|
},
|
|
name: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
type: {
|
|
type: String,
|
|
default: AppTypeEnum.workflow,
|
|
enum: Object.values(AppTypeEnum)
|
|
},
|
|
version: {
|
|
type: String,
|
|
enum: ['v1', 'v2']
|
|
},
|
|
avatar: {
|
|
type: String,
|
|
default: '/icon/logo.svg'
|
|
},
|
|
intro: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
templateId: String,
|
|
|
|
updateTime: {
|
|
type: Date,
|
|
default: () => new Date()
|
|
},
|
|
|
|
// Workflow data
|
|
modules: {
|
|
type: Array,
|
|
default: []
|
|
},
|
|
edges: {
|
|
type: Array,
|
|
default: []
|
|
},
|
|
chatConfig: {
|
|
type: chatConfigType
|
|
},
|
|
|
|
// Tool config
|
|
pluginData: {
|
|
type: {
|
|
nodeVersion: String,
|
|
pluginUniId: String,
|
|
apiSchemaStr: String, // http plugin
|
|
customHeaders: String // http plugin
|
|
}
|
|
},
|
|
|
|
scheduledTriggerConfig: {
|
|
cronString: {
|
|
type: String
|
|
},
|
|
timezone: {
|
|
type: String
|
|
},
|
|
defaultPrompt: {
|
|
type: String
|
|
}
|
|
},
|
|
scheduledTriggerNextTime: {
|
|
type: Date
|
|
},
|
|
|
|
inheritPermission: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
|
|
// Chat setting
|
|
favourite: Boolean,
|
|
quick: Boolean,
|
|
|
|
/** @deprecated */
|
|
defaultPermission: Number,
|
|
inited: Boolean,
|
|
teamTags: {
|
|
type: [String]
|
|
}
|
|
},
|
|
{
|
|
minimize: false
|
|
}
|
|
);
|
|
|
|
AppSchema.index({ teamId: 1, updateTime: -1 });
|
|
AppSchema.index({ teamId: 1, type: 1 });
|
|
AppSchema.index(
|
|
{ scheduledTriggerConfig: 1, scheduledTriggerNextTime: -1 },
|
|
{
|
|
partialFilterExpression: {
|
|
scheduledTriggerConfig: { $exists: true }
|
|
}
|
|
}
|
|
);
|
|
// Admin count
|
|
AppSchema.index({ type: 1 });
|
|
|
|
export const MongoApp = getMongoModel<AppType>(AppCollectionName, AppSchema);
|