From 9a831b5b8b537827a3238d1aafddeb6cfeb250e3 Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Sat, 10 Jun 2023 23:22:37 +0800 Subject: [PATCH] fix: env conf --- client/src/pages/api/openapi/text/sensitiveCheck.ts | 2 +- client/src/pages/api/system/getModels.ts | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/client/src/pages/api/openapi/text/sensitiveCheck.ts b/client/src/pages/api/openapi/text/sensitiveCheck.ts index b7cec7e08..90b305fc7 100644 --- a/client/src/pages/api/openapi/text/sensitiveCheck.ts +++ b/client/src/pages/api/openapi/text/sensitiveCheck.ts @@ -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); } diff --git a/client/src/pages/api/system/getModels.ts b/client/src/pages/api/system/getModels.ts index df03da0f4..843d5c512 100644 --- a/client/src/pages/api/system/getModels.ts +++ b/client/src/pages/api/system/getModels.ts @@ -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