This commit is contained in:
archer
2023-07-17 17:39:36 +08:00
parent 53a4d9db05
commit dc1599ba3c
21 changed files with 762 additions and 54 deletions

View File

@@ -18,8 +18,10 @@ export const moduleFetch = ({ url, data, res }: Props) =>
const requestUrl = url.startsWith('/') ? `${baseUrl}${url}` : url;
const response = await fetch(requestUrl, {
method: 'POST',
// @ts-ignore
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
rootkey: process.env.ROOT_KEY
},
body: JSON.stringify(data),
signal: abortSignal.signal

View File

@@ -50,6 +50,48 @@ const AppSchema = new Schema({
modules: {
type: Array,
default: []
},
chat: {
relatedKbs: {
type: [Schema.Types.ObjectId],
ref: 'kb',
default: []
},
searchSimilarity: {
type: Number,
default: 0.8
},
searchLimit: {
type: Number,
default: 5
},
searchEmptyText: {
type: String,
default: ''
},
systemPrompt: {
type: String,
default: ''
},
limitPrompt: {
type: String,
default: ''
},
maxToken: {
type: Number,
default: 4000,
min: 100
},
temperature: {
type: Number,
min: 0,
max: 10,
default: 0
},
chatModel: {
// 聊天时使用的模型
type: String
}
}
});

View File

@@ -3,7 +3,6 @@ import jwt from 'jsonwebtoken';
import Cookie from 'cookie';
import { App, OpenApi, User, ShareChat, KB } from '../mongo';
import type { AppSchema } from '@/types/mongoSchema';
import { defaultApp } from '@/constants/model';
import { formatPrice } from '@/utils/user';
import { ERROR_ENUM } from '../errorCode';