perf: completion chatId

This commit is contained in:
archer
2023-07-23 20:07:35 +08:00
parent b7d18e38d1
commit 67e10d6f2c
35 changed files with 447 additions and 385 deletions

View File

@@ -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: []

View File

@@ -24,10 +24,6 @@ const ShareChatSchema = new Schema({
type: Number,
default: 0
},
maxContext: {
type: Number,
default: 20
},
lastTime: {
type: Date
}