Files
FastGPT/packages/service/core/app/schema.ts
Archer 8aa6b53760 V4.8.14 dev (#3234)
* feat: rewrite chat context (#3176)

* feat: add app auto execute (#3115)

* feat: add app auto execute

* auto exec configtion

* chatting animation

* change icon

* fix

* fix

* fix link

* feat: add chat context to all chatbox

* perf: loading ui

---------

Co-authored-by: heheer <heheer@sealos.io>

* app auto exec (#3179)

* add chat records loaded state (#3184)

* perf: chat store reset storage (#3186)

* perf: chat store reset storage

* perf: auto exec code

* chore: workflow ui (#3175)

* chore: workflow ui

* fix

* change icon color config

* change popover to mymenu

* 4.8.14 test (#3189)

* update doc

* fix: token check

* perf: icon button

* update doc

* feat: share page support configuration Whether to allow the original view (#3194)

* update doc

* perf: fix index (#3206)

* perf: i18n

* perf: Add service entry (#3226)

* 4.8.14 test (#3228)

* fix: ai log

* fix: text splitter

* fix: reference unselect & user form description & simple to advance (#3229)

* fix: reference unselect & user form description & simple to advance

* change abort position

* perf

* perf: code (#3232)

* perf: code

* update doc

* fix: create btn permission (#3233)

* update doc

* fix: refresh chatbox listener

* perf: check invalid reference

* perf: check invalid reference

* update doc

* fix: ui props

---------

Co-authored-by: heheer <heheer@sealos.io>
2024-11-26 12:02:58 +08:00

127 lines
2.4 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: Boolean,
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: ''
},
updateTime: {
type: Date,
default: () => new Date()
},
// role and auth
teamTags: {
type: [String]
},
// save app(Not publish)
modules: {
type: Array,
default: []
},
edges: {
type: Array,
default: []
},
chatConfig: {
type: chatConfigType
},
// plugin 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
},
inited: {
type: Boolean
},
inheritPermission: {
type: Boolean,
default: true
},
// abandoned
defaultPermission: Number
});
AppSchema.index({ teamId: 1, updateTime: -1 });
AppSchema.index({ teamId: 1, type: 1 });
AppSchema.index({ scheduledTriggerConfig: 1, intervalNextTime: -1 });
export const MongoApp = getMongoModel<AppType>(AppCollectionName, AppSchema);