Files
monkey-ai-web/src/config/cloudBrainUi.js
T
2026-10-15 16:33:46 +08:00

79 lines
2.6 KiB
JavaScript

/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
export const parseFrontendBoolean = (value, fallback = false) => {
if (value === undefined || value === null || value === '') return fallback;
return ['1', 'true', 'yes', 'on'].includes(String(value).toLowerCase());
};
// This is a build-time switch. Missing configuration deliberately hides the
// entire suite so unrelated emergency releases cannot expose unfinished UI.
export const CLOUD_BRAIN_UI_ENABLED = parseFrontendBoolean(
import.meta.env?.VITE_CLOUD_BRAIN_UI_ENABLED,
false,
);
export const CLOUD_BRAIN_ORG_MODULE_KEYS = new Set([
'cloudBrain',
'knowledge',
'mySkills',
// 该 key 已不再控制"企业技能市场页"(页面已并入平台超市),改为控制超市页上
// 的「为企业启用」治理面。仍属云脑套件,构建开关关闭时运营设置里也应隐藏它,
// 否则会留下一个可见但完全无效的开关。
'skillMarket',
'skillLibrary',
'privateSkills',
'skillAssignments',
'experts',
'agentAudit',
'connectors',
'myConnectors',
'effectiveness',
]);
// 合并页:/org/my-capabilities = 我的技能 + 业务系统授权;
// /org/skill-center = 企业技能库 + 企业自研 Skill。
// 旧路径已改为重定向,不再作为侧栏项出现,无需列入。
export const CLOUD_BRAIN_ORG_PATHS = new Set([
'/org/cloud-brain',
'/org/knowledge',
'/org/my-capabilities',
'/org/skill-center',
'/org/skill-assignments',
'/org/experts',
'/org/agent-audit',
'/org/connectors',
'/org/effectiveness',
]);
export const CLOUD_BRAIN_ORG_FEATURE_KEYS = new Set([
'cloud_brain',
'expert',
'skill_market',
'knowledge_base',
'connector',
'enterprise_knowledge',
'agent_effectiveness',
]);
export const isCloudBrainOrgModule = (key) =>
CLOUD_BRAIN_ORG_MODULE_KEYS.has(key);
export const isCloudBrainOrgPath = (path) => CLOUD_BRAIN_ORG_PATHS.has(path);