new framwork

This commit is contained in:
archer
2023-06-09 12:57:42 +08:00
parent d9450bd7ee
commit ba9d9c3d5f
263 changed files with 12269 additions and 11599 deletions

View File

@@ -0,0 +1,23 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import { jsonRes } from '@/service/response';
import type { ChatModelItemType } from '@/constants/model';
import { ChatModelMap, OpenAiChatEnum, ClaudeEnum } 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) {
chatModelList.push(ChatModelMap[OpenAiChatEnum.GPT35]);
}
if (process.env.GPT4KEY) {
chatModelList.push(ChatModelMap[OpenAiChatEnum.GPT4]);
}
if (process.env.CLAUDE_KEY) {
chatModelList.push(ChatModelMap[ClaudeEnum.Claude]);
}
jsonRes(res, {
data: chatModelList
});
}