mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-16 16:04:34 +00:00
perf: variabel replace;Feat: prompt optimizer code (#5453)
* feat: add prompt optimizer (#5444) * feat: add prompt optimizer * fix * perf: variabel replace * perf: prompt optimizer code * feat: init charts shell * perf: user error remove --------- Co-authored-by: heheer <heheer@sealos.io>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { connectionMongo, getMongoModel } from '../../common/mongo';
|
||||
const { Schema } = connectionMongo;
|
||||
import { type ChatSchema as ChatType } from '@fastgpt/global/core/chat/type.d';
|
||||
import { type ChatSchemaType } from '@fastgpt/global/core/chat/type.d';
|
||||
import { ChatSourceEnum } from '@fastgpt/global/core/chat/constants';
|
||||
import {
|
||||
TeamCollectionName,
|
||||
@@ -83,10 +83,13 @@ const ChatSchema = new Schema({
|
||||
//For special storage
|
||||
type: Object,
|
||||
default: {}
|
||||
}
|
||||
},
|
||||
|
||||
initStatistics: Boolean
|
||||
});
|
||||
|
||||
try {
|
||||
ChatSchema.index({ initCharts: 1 });
|
||||
ChatSchema.index({ chatId: 1 });
|
||||
// get user history
|
||||
ChatSchema.index({ tmbId: 1, appId: 1, top: -1, updateTime: -1 });
|
||||
@@ -104,4 +107,4 @@ try {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
export const MongoChat = getMongoModel<ChatType>(chatCollectionName, ChatSchema);
|
||||
export const MongoChat = getMongoModel<ChatSchemaType>(chatCollectionName, ChatSchema);
|
||||
|
@@ -165,7 +165,7 @@ export async function saveChat({
|
||||
});
|
||||
|
||||
try {
|
||||
const userId = outLinkUid || tmbId;
|
||||
const userId = String(outLinkUid || tmbId);
|
||||
const now = new Date();
|
||||
const fifteenMinutesAgo = new Date(now.getTime() - 15 * 60 * 1000);
|
||||
|
||||
|
Reference in New Issue
Block a user