perf: completion chatId
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import { Schema, model, models, Model } from 'mongoose';
|
||||
import { ChatSchema as ChatType } from '@/types/mongoSchema';
|
||||
import { ChatRoleMap } from '@/constants/chat';
|
||||
import { ChatRoleMap, TaskResponseKeyEnum } from '@/constants/chat';
|
||||
import { ChatSourceEnum, ChatSourceMap } from '@/constants/chat';
|
||||
|
||||
const ChatSchema = new Schema({
|
||||
chatId: {
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
userId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'user',
|
||||
@@ -33,14 +37,14 @@ const ChatSchema = new Schema({
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
// source: {
|
||||
// type: String,
|
||||
// enum: Object.keys(ChatSourceMap),
|
||||
// required: true
|
||||
// },
|
||||
// shareId: {
|
||||
// type: String
|
||||
// },
|
||||
source: {
|
||||
type: String,
|
||||
enum: Object.keys(ChatSourceMap),
|
||||
required: true
|
||||
},
|
||||
shareId: {
|
||||
type: String
|
||||
},
|
||||
content: {
|
||||
type: [
|
||||
{
|
||||
@@ -53,14 +57,22 @@ const ChatSchema = new Schema({
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
rawSearch: {
|
||||
[TaskResponseKeyEnum.responseData]: {
|
||||
type: [
|
||||
{
|
||||
id: String,
|
||||
q: String,
|
||||
a: String,
|
||||
kb_id: String,
|
||||
source: String
|
||||
moduleName: String,
|
||||
price: String,
|
||||
model: String,
|
||||
tokens: Number,
|
||||
question: String,
|
||||
answer: String,
|
||||
temperature: Number,
|
||||
maxToken: Number,
|
||||
finishMessages: Array,
|
||||
similarity: Number,
|
||||
limit: Number,
|
||||
cqList: Array,
|
||||
cqResult: String
|
||||
}
|
||||
],
|
||||
default: []
|
||||
|
||||
@@ -24,10 +24,6 @@ const ShareChatSchema = new Schema({
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
maxContext: {
|
||||
type: Number,
|
||||
default: 20
|
||||
},
|
||||
lastTime: {
|
||||
type: Date
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user