@liujitcn/kratos-admin-core 0.0.64 → 0.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -24,12 +24,18 @@ function normalizeRoutePath(path?: string, parentPath = "") {
|
|
|
24
24
|
function normalizeRouteTree(menuList: RouteItem[], parentPath = "", aiEnabled = false): RouteItem[] {
|
|
25
25
|
return menuList.map(item => {
|
|
26
26
|
const currentPath = normalizeRoutePath(item.path, parentPath);
|
|
27
|
+
const meta =
|
|
28
|
+
item.name === "AiChat"
|
|
29
|
+
? {
|
|
30
|
+
...item.meta,
|
|
31
|
+
params: item.meta?.params ?? [],
|
|
32
|
+
// 后端已显式隐藏时不因本地 AI 开关被重新打开。
|
|
33
|
+
hidden: item.meta?.hidden === true ? true : !aiEnabled
|
|
34
|
+
}
|
|
35
|
+
: item.meta;
|
|
27
36
|
return {
|
|
28
37
|
...item,
|
|
29
|
-
meta
|
|
30
|
-
item.name === "AiChat"
|
|
31
|
-
? { ...item.meta, params: item.meta?.params ?? [], hidden: !aiEnabled }
|
|
32
|
-
: item.meta,
|
|
38
|
+
meta,
|
|
33
39
|
path: currentPath,
|
|
34
40
|
children: normalizeRouteTree(item.children ?? [], currentPath, aiEnabled)
|
|
35
41
|
};
|
|
@@ -108,6 +108,8 @@ export const useConfigStore = defineStore("admin-config", {
|
|
|
108
108
|
this.display = { ...DEFAULT_SITE_DISPLAY_CONFIG };
|
|
109
109
|
this.captcha = { ...DEFAULT_LOGIN_CAPTCHA_CONFIG };
|
|
110
110
|
this.i18nDraftEnabled = false;
|
|
111
|
+
// 避免登出或切换租户后沿用上一租户的 AI 菜单显隐状态。
|
|
112
|
+
this.aiEnabled = false;
|
|
111
113
|
},
|
|
112
114
|
/**
|
|
113
115
|
* 加载管理端站点配置,并以服务端返回值覆盖本地默认值。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** 判断响应是否包含结构化错误码。字符串 code 属于业务数据字段,不作为错误码。 */
|
|
2
2
|
export function hasStructuredErrorCode<T extends object>(value: T): value is T & { code: number } {
|
|
3
3
|
return typeof value === "object" && !Array.isArray(value) && "code" in value && typeof value.code === "number";
|
|
4
4
|
}
|