mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-05 22:55:27 +00:00
new framwork
This commit is contained in:
17
client/src/pages/api/system/getInitData.ts
Normal file
17
client/src/pages/api/system/getInitData.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@/service/response';
|
||||
|
||||
export type InitDateResponse = {
|
||||
beianText: string;
|
||||
googleVerKey: string;
|
||||
};
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
jsonRes<InitDateResponse>(res, {
|
||||
data: {
|
||||
beianText: process.env.SAFE_BEIAN_TEXT || '',
|
||||
googleVerKey: process.env.CLIENT_GOOGLE_VER_TOKEN || ''
|
||||
}
|
||||
});
|
||||
}
|
23
client/src/pages/api/system/getModels.ts
Normal file
23
client/src/pages/api/system/getModels.ts
Normal 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
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user