4.8.14 test (#3164)
* perf: match base 64 image * perf: register plugins
This commit is contained in:
@@ -11,7 +11,8 @@ const getCommercialPlugins = () => {
|
||||
return GET<SystemPluginTemplateItemType[]>('/core/app/plugin/getSystemPlugins');
|
||||
};
|
||||
export const getSystemPlugins = async (refresh = false) => {
|
||||
if (isProduction && global.systemPlugins && !refresh) return cloneDeep(global.systemPlugins);
|
||||
if (isProduction && global.systemPlugins && global.systemPlugins.length > 0 && !refresh)
|
||||
return cloneDeep(global.systemPlugins);
|
||||
|
||||
try {
|
||||
if (!global.systemPlugins) {
|
||||
@@ -22,8 +23,6 @@ export const getSystemPlugins = async (refresh = false) => {
|
||||
|
||||
addLog.info(`Load system plugin successfully: ${global.systemPlugins.length}`);
|
||||
|
||||
getSystemPluginCb();
|
||||
|
||||
return cloneDeep(global.systemPlugins);
|
||||
} catch (error) {
|
||||
//@ts-ignore
|
||||
@@ -56,16 +55,22 @@ const getCommercialCb = async () => {
|
||||
{}
|
||||
);
|
||||
};
|
||||
export const getSystemPluginCb = async () => {
|
||||
if (isProduction && global.systemPluginCb) return global.systemPluginCb;
|
||||
|
||||
export const getSystemPluginCb = async (refresh = false) => {
|
||||
if (
|
||||
isProduction &&
|
||||
global.systemPluginCb &&
|
||||
Object.keys(global.systemPluginCb).length > 0 &&
|
||||
!refresh
|
||||
)
|
||||
return global.systemPluginCb;
|
||||
|
||||
try {
|
||||
global.systemPluginCb = {};
|
||||
await getSystemPlugins();
|
||||
global.systemPluginCb = FastGPTProUrl ? await getCommercialCb() : await getCommunityCb();
|
||||
return global.systemPluginCb;
|
||||
} catch (error) {
|
||||
//@ts-ignore
|
||||
global.systemPluginCb = undefined;
|
||||
return Promise.reject(error);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user