fix: env conf

This commit is contained in:
archer 2023-06-10 23:22:37 +08:00
parent 7957f96d2c
commit 9a831b5b8b
No known key found for this signature in database
GPG Key ID: 569A5660D2379E28
2 changed files with 4 additions and 7 deletions

View File

@ -8,7 +8,7 @@ import { axiosConfig } from '@/service/utils/tools';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
if (global.systemEnv.sensitiveCheck) {
if (!global.systemEnv.sensitiveCheck) {
return jsonRes(res);
}

View File

@ -1,21 +1,18 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import { jsonRes } from '@/service/response';
import type { ChatModelItemType } from '@/constants/model';
import { ChatModelMap, OpenAiChatEnum, ClaudeEnum } from '@/constants/model';
import { ChatModelMap, OpenAiChatEnum } from '@/constants/model';
// get the models available to the system
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const chatModelList: ChatModelItemType[] = [];
if (process.env.OPENAIKEY) {
if (global.systemEnv.openAIKeys) {
chatModelList.push(ChatModelMap[OpenAiChatEnum.GPT35]);
}
if (process.env.GPT4KEY) {
if (global.systemEnv.gpt4Key) {
chatModelList.push(ChatModelMap[OpenAiChatEnum.GPT4]);
}
if (process.env.CLAUDE_KEY) {
chatModelList.push(ChatModelMap[ClaudeEnum.Claude]);
}
jsonRes(res, {
data: chatModelList