mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-14 07:00:47 +00:00
perF: getInitData api cache;perf: tool description field;signoz store level (#5465)
* perf: auto focus * perF: getInitData api cache * perf: tool description field * signoz store level * perF: chat logs index
This commit is contained in:
@@ -34,13 +34,15 @@ const envLogLevelMap: Record<string, number> = {
|
||||
error: LogLevelEnum.error
|
||||
};
|
||||
|
||||
const { LOG_LEVEL, STORE_LOG_LEVEL } = (() => {
|
||||
const { LOG_LEVEL, STORE_LOG_LEVEL, SIGNOZ_STORE_LEVEL } = (() => {
|
||||
const LOG_LEVEL = (process.env.LOG_LEVEL || 'info').toLocaleLowerCase();
|
||||
const STORE_LOG_LEVEL = (process.env.STORE_LOG_LEVEL || '').toLocaleLowerCase();
|
||||
const SIGNOZ_STORE_LEVEL = (process.env.SIGNOZ_STORE_LEVEL || 'warn').toLocaleLowerCase();
|
||||
|
||||
return {
|
||||
LOG_LEVEL: envLogLevelMap[LOG_LEVEL] ?? LogLevelEnum.info,
|
||||
STORE_LOG_LEVEL: envLogLevelMap[STORE_LOG_LEVEL] ?? 99
|
||||
STORE_LOG_LEVEL: envLogLevelMap[STORE_LOG_LEVEL] ?? 99,
|
||||
SIGNOZ_STORE_LEVEL: envLogLevelMap[SIGNOZ_STORE_LEVEL] ?? LogLevelEnum.warn
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -60,7 +62,7 @@ export const addLog = {
|
||||
|
||||
level === LogLevelEnum.error && console.error(obj);
|
||||
|
||||
if (logger) {
|
||||
if (logger && level >= SIGNOZ_STORE_LEVEL) {
|
||||
logger.emit({
|
||||
severityNumber: level.valueOf(),
|
||||
severityText: ['debug', 'info', 'warn', 'error'][level],
|
||||
|
@@ -173,6 +173,17 @@ export const loadSystemModels = async (init = false) => {
|
||||
const providerB = getModelProvider(b.provider);
|
||||
return providerA.order - providerB.order;
|
||||
});
|
||||
global.systemActiveDesensitizedModels = global.systemActiveModelList.map((model) => ({
|
||||
...model,
|
||||
defaultSystemChatPrompt: undefined,
|
||||
fieldMap: undefined,
|
||||
defaultConfig: undefined,
|
||||
weight: undefined,
|
||||
dbConfig: undefined,
|
||||
queryConfig: undefined,
|
||||
requestUrl: undefined,
|
||||
requestAuth: undefined
|
||||
})) as SystemModelItemType[];
|
||||
|
||||
console.log(
|
||||
`Load models success, total: ${global.systemModelList.length}, active: ${global.systemActiveModelList.length}`,
|
||||
|
1
packages/service/core/ai/type.d.ts
vendored
1
packages/service/core/ai/type.d.ts
vendored
@@ -41,5 +41,6 @@ declare global {
|
||||
var reRankModelMap: Map<string, RerankModelItemType>;
|
||||
|
||||
var systemActiveModelList: SystemModelItemType[];
|
||||
var systemActiveDesensitizedModels: SystemModelItemType[];
|
||||
var systemDefaultModel: SystemDefaultModelType;
|
||||
}
|
||||
|
@@ -314,11 +314,7 @@ export async function getChildAppPreviewNode({
|
||||
}))
|
||||
}
|
||||
}
|
||||
: {
|
||||
systemTool: {
|
||||
toolId: app.id
|
||||
}
|
||||
})
|
||||
: { systemTool: { toolId: app.id } })
|
||||
},
|
||||
showSourceHandle: app.isFolder ? false : true,
|
||||
showTargetHandle: app.isFolder ? false : true
|
||||
@@ -541,23 +537,6 @@ export const getSystemTools = async (): Promise<SystemPluginTemplateItemType[]>
|
||||
const systemToolsArray = await MongoSystemPlugin.find({}).lean();
|
||||
const systemTools = new Map(systemToolsArray.map((plugin) => [plugin.pluginId, plugin]));
|
||||
|
||||
// tools.forEach((tool) => {
|
||||
// // 如果有插件的配置信息,则需要进行替换
|
||||
// const dbPluginConfig = systemTools.get(tool.id);
|
||||
|
||||
// if (dbPluginConfig) {
|
||||
// const children = tools.filter((item) => item.parentId === tool.id);
|
||||
// const list = [tool, ...children];
|
||||
// list.forEach((item) => {
|
||||
// item.isActive = dbPluginConfig.isActive ?? item.isActive ?? true;
|
||||
// item.originCost = dbPluginConfig.originCost ?? 0;
|
||||
// item.currentCost = dbPluginConfig.currentCost ?? 0;
|
||||
// item.hasTokenFee = dbPluginConfig.hasTokenFee ?? false;
|
||||
// item.pluginOrder = dbPluginConfig.pluginOrder ?? 0;
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
const formatTools = tools.map<SystemPluginTemplateItemType>((item) => {
|
||||
const dbPluginConfig = systemTools.get(item.id);
|
||||
const isFolder = tools.some((tool) => tool.parentId === item.id);
|
||||
|
@@ -88,6 +88,7 @@ export async function rewriteAppWorkflowToDetail({
|
||||
node.isFolder = preview.isFolder;
|
||||
|
||||
node.toolConfig = preview.toolConfig;
|
||||
node.toolDescription = preview.toolDescription;
|
||||
|
||||
// Latest version
|
||||
if (!node.version) {
|
||||
|
@@ -21,7 +21,7 @@
|
||||
"Optimizer_Placeholder_loading": "Generating...please wait",
|
||||
"Optimizer_Reoptimize": "Re-optimize",
|
||||
"Optimizer_Replace": "replace",
|
||||
"Optimizer_Tooltip": "AI Optimization",
|
||||
"Optimizer_Tooltip": "AI optimization prompt words",
|
||||
"Role_setting": "Permission",
|
||||
"Run": "Execute",
|
||||
"Search_dataset": "Search dataset",
|
||||
|
@@ -21,7 +21,7 @@
|
||||
"Optimizer_Placeholder_loading": "正在生成...请稍候",
|
||||
"Optimizer_Reoptimize": "重新优化",
|
||||
"Optimizer_Replace": "替换",
|
||||
"Optimizer_Tooltip": "AI 优化",
|
||||
"Optimizer_Tooltip": "AI 优化提示词",
|
||||
"Role_setting": "权限设置",
|
||||
"Run": "运行",
|
||||
"Search_dataset": "搜索知识库",
|
||||
|
@@ -21,7 +21,7 @@
|
||||
"Optimizer_Placeholder_loading": "正在生成...請稍候",
|
||||
"Optimizer_Reoptimize": "重新優化",
|
||||
"Optimizer_Replace": "替換",
|
||||
"Optimizer_Tooltip": "AI 優化",
|
||||
"Optimizer_Tooltip": "AI 優化提示詞",
|
||||
"Role_setting": "權限設定",
|
||||
"Run": "執行",
|
||||
"Search_dataset": "搜尋知識庫",
|
||||
|
Reference in New Issue
Block a user