FastGPT/projects/app/src/pages/api/common/system/getInitData.ts
Archer 108e1b92ef
Some checks failed
Deploy doc image by kubeconfig / build-fastgpt-docs-images (push) Has been cancelled
Deploy doc image to vercel / deploy-production (push) Has been cancelled
Build FastGPT images in Personal warehouse / build-fastgpt-images (push) Has been cancelled
Sync images / sync (push) Has been cancelled
Deploy doc image by kubeconfig / update-docs-image (push) Has been cancelled
perf: model provider show; perf: get init data buffer (#3459)
* pr code

* perf: model table show

* perf: model provider show

* perf: get init data buffer

* perf: get init data buffer

* perf: icon
2024-12-24 15:12:07 +08:00

39 lines
1.1 KiB
TypeScript

import type { NextApiResponse } from 'next';
import { ApiRequestProps } from '@fastgpt/service/type/next';
import { NextAPI } from '@/service/middleware/entry';
async function handler(req: ApiRequestProps<{}, { bufferId?: string }>, res: NextApiResponse) {
const { bufferId } = req.query;
// If bufferId is the same as the current bufferId, return directly
if (bufferId && global.systemInitBufferId && global.systemInitBufferId === bufferId) {
return {
bufferId: global.systemInitBufferId
};
}
return {
bufferId: global.systemInitBufferId,
feConfigs: global.feConfigs,
subPlans: global.subPlans,
llmModels: global.llmModels.map((model) => ({
...model,
customCQPrompt: '',
customExtractPrompt: '',
defaultSystemChatPrompt: ''
})),
vectorModels: global.vectorModels,
reRankModels:
global.reRankModels?.map((item) => ({
...item,
requestUrl: '',
requestAuth: ''
})) || [],
whisperModel: global.whisperModel,
audioSpeechModels: global.audioSpeechModels,
systemVersion: global.systemVersion || '0.0.0'
};
}
export default NextAPI(handler);