Aiproxy (#3649)
* model config * feat: model config ui * perf: rename variable * feat: custom request url * perf: model buffer * perf: init model * feat: json model config * auto login * fix: ts * update packages * package * fix: dockerfile
This commit is contained in:
@@ -6,8 +6,7 @@ import { FastGPTProUrl } from '../constants';
|
||||
export const getFastGPTConfigFromDB = async () => {
|
||||
if (!FastGPTProUrl) {
|
||||
return {
|
||||
config: {} as FastGPTConfigFileType,
|
||||
configId: undefined
|
||||
config: {} as FastGPTConfigFileType
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,9 +17,25 @@ export const getFastGPTConfigFromDB = async () => {
|
||||
});
|
||||
|
||||
const config = res?.value || {};
|
||||
// 利用配置文件的创建时间(更新时间)来做缓存,如果前端命中缓存,则不需要再返回配置文件
|
||||
global.systemInitBufferId = res ? res.createTime.getTime().toString() : undefined;
|
||||
|
||||
return {
|
||||
configId: res ? String(res._id) : undefined,
|
||||
config: config as FastGPTConfigFileType
|
||||
};
|
||||
};
|
||||
|
||||
export const updateFastGPTConfigBuffer = async () => {
|
||||
const res = await MongoSystemConfigs.findOne({
|
||||
type: SystemConfigsTypeEnum.fastgpt
|
||||
}).sort({
|
||||
createTime: -1
|
||||
});
|
||||
|
||||
if (!res) return;
|
||||
|
||||
res.createTime = new Date();
|
||||
await res.save();
|
||||
|
||||
global.systemInitBufferId = res.createTime.getTime().toString();
|
||||
};
|
||||
|
||||
@@ -13,15 +13,6 @@ export const initFastGPTConfig = (config?: FastGPTConfigFileType) => {
|
||||
global.feConfigs = config.feConfigs;
|
||||
global.systemEnv = config.systemEnv;
|
||||
global.subPlans = config.subPlans;
|
||||
|
||||
global.llmModels = config.llmModels;
|
||||
global.llmModelPriceType = global.llmModels.some((item) => typeof item.inputPrice === 'number')
|
||||
? 'IO'
|
||||
: 'Tokens';
|
||||
global.vectorModels = config.vectorModels;
|
||||
global.audioSpeechModels = config.audioSpeechModels;
|
||||
global.whisperModel = config.whisperModel;
|
||||
global.reRankModels = config.reRankModels;
|
||||
};
|
||||
|
||||
export const systemStartCb = () => {
|
||||
|
||||
Reference in New Issue
Block a user