mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
Perf input guide (#1557)
* perf: input guide code * perf: input guide ui * Chat input guide api * Update app chat config store * perf: app chat config field * perf: app context * perf: params * fix: ts * perf: filter private config * perf: filter private config * perf: import workflow * perf: limit max tip amount
This commit is contained in:
29
packages/service/core/chat/inputGuide/schema.ts
Normal file
29
packages/service/core/chat/inputGuide/schema.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { AppCollectionName } from '../../app/schema';
|
||||
import { connectionMongo, type Model } from '../../../common/mongo';
|
||||
const { Schema, model, models } = connectionMongo;
|
||||
import type { ChatInputGuideSchemaType } from '@fastgpt/global/core/chat/inputGuide/type.d';
|
||||
|
||||
export const ChatInputGuideCollectionName = 'chat_input_guides';
|
||||
|
||||
const ChatInputGuideSchema = new Schema({
|
||||
appId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: AppCollectionName,
|
||||
required: true
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
ChatInputGuideSchema.index({ appId: 1, text: 1 }, { unique: true });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
export const MongoChatInputGuide: Model<ChatInputGuideSchemaType> =
|
||||
models[ChatInputGuideCollectionName] || model(ChatInputGuideCollectionName, ChatInputGuideSchema);
|
||||
|
||||
MongoChatInputGuide.syncIndexes();
|
Reference in New Issue
Block a user