mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-06-14 02:40:45 +08:00
feat(i18n): localize planner and authority diagnostics
This commit is contained in:
@@ -18,6 +18,10 @@ export function createAuthorityUpgradeState(overrides = {}) {
|
||||
mode,
|
||||
text: normalizeString(overrides.text, "纯前端模式"),
|
||||
meta: normalizeString(overrides.meta, "未检测到可用服务端增强,BME 将继续本地运行"),
|
||||
textKey: normalizeString(overrides.textKey, "authority.mode.standalone"),
|
||||
metaKey: normalizeString(overrides.metaKey, "authority.mode.standalone.meta"),
|
||||
textParams: overrides.textParams ?? {},
|
||||
metaParams: overrides.metaParams ?? {},
|
||||
level: normalizeString(overrides.level, "idle"),
|
||||
ready: Boolean(overrides.ready),
|
||||
reason: normalizeString(overrides.reason, "standalone"),
|
||||
@@ -57,6 +61,8 @@ export function deriveAuthorityUpgradeState({
|
||||
mode: AUTHORITY_UPGRADE_MODES.STANDALONE,
|
||||
text: "纯前端模式",
|
||||
meta: "服务端增强已关闭,BME 将继续本地运行",
|
||||
textKey: "authority.mode.standalone",
|
||||
metaKey: "authority.mode.standalone.disabled.meta",
|
||||
level: "idle",
|
||||
reason: "authority-disabled",
|
||||
browserCacheMode,
|
||||
@@ -69,6 +75,8 @@ export function deriveAuthorityUpgradeState({
|
||||
mode: AUTHORITY_UPGRADE_MODES.STANDALONE,
|
||||
text: "纯前端模式",
|
||||
meta: "未检测到 DOA/Authority,已自动使用本地稳定路径",
|
||||
textKey: "authority.mode.standalone",
|
||||
metaKey: "authority.mode.standalone.noAuthority.meta",
|
||||
level: "idle",
|
||||
reason,
|
||||
browserCacheMode,
|
||||
@@ -81,6 +89,9 @@ export function deriveAuthorityUpgradeState({
|
||||
mode: AUTHORITY_UPGRADE_MODES.DEGRADED,
|
||||
text: "已自动回退",
|
||||
meta: `服务端增强暂不可用:${reason}`,
|
||||
textKey: "authority.mode.degraded",
|
||||
metaKey: "authority.mode.degraded.unhealthy.meta",
|
||||
metaParams: { reason },
|
||||
level: "warning",
|
||||
reason,
|
||||
browserCacheMode,
|
||||
@@ -93,6 +104,8 @@ export function deriveAuthorityUpgradeState({
|
||||
mode: AUTHORITY_UPGRADE_MODES.SHADOW,
|
||||
text: "服务端影子同步",
|
||||
meta: "DOA/Authority 可用,但当前仍以本地路径为主",
|
||||
textKey: "authority.mode.shadow",
|
||||
metaKey: "authority.mode.shadow.meta",
|
||||
level: "info",
|
||||
reason: "primary-disabled",
|
||||
serverPrimaryReady,
|
||||
@@ -108,6 +121,11 @@ export function deriveAuthorityUpgradeState({
|
||||
}
|
||||
|
||||
if (storageReady && vectorReady) {
|
||||
const enhancedMetaKey = jobsReady
|
||||
? bmeVectorManifestReady
|
||||
? "authority.mode.enhanced.meta.manifestReady"
|
||||
: "authority.mode.enhanced.meta.noManifest"
|
||||
: "authority.mode.enhanced.meta.noJobs";
|
||||
return createAuthorityUpgradeState({
|
||||
mode: AUTHORITY_UPGRADE_MODES.ENHANCED,
|
||||
text: "服务端增强已启用",
|
||||
@@ -116,6 +134,8 @@ export function deriveAuthorityUpgradeState({
|
||||
? "图谱与向量存储已增强,服务端向量清单可用"
|
||||
: "图谱与向量存储已增强,等待 BME 向量清单能力"
|
||||
: "图谱与向量存储已增强,服务端后台任务能力暂不可用",
|
||||
textKey: "authority.mode.enhanced",
|
||||
metaKey: enhancedMetaKey,
|
||||
level: "success",
|
||||
ready: true,
|
||||
reason: "authority-ready",
|
||||
@@ -132,12 +152,17 @@ export function deriveAuthorityUpgradeState({
|
||||
}
|
||||
|
||||
if (storageReady || vectorReady) {
|
||||
const candidateMetaKey = storageReady
|
||||
? "authority.mode.candidate.meta.storageReady"
|
||||
: "authority.mode.candidate.meta.vectorReady";
|
||||
return createAuthorityUpgradeState({
|
||||
mode: AUTHORITY_UPGRADE_MODES.CANDIDATE,
|
||||
text: "服务端增强准备中",
|
||||
meta: storageReady
|
||||
? "图谱服务端存储可用,向量增强仍在等待能力确认"
|
||||
: "向量服务端能力可用,图谱服务端存储仍在等待能力确认",
|
||||
textKey: "authority.mode.candidate",
|
||||
metaKey: candidateMetaKey,
|
||||
level: "info",
|
||||
reason: "partial-authority-ready",
|
||||
serverPrimaryReady,
|
||||
@@ -156,6 +181,9 @@ export function deriveAuthorityUpgradeState({
|
||||
mode: AUTHORITY_UPGRADE_MODES.DEGRADED,
|
||||
text: "已自动回退",
|
||||
meta: `DOA/Authority 已连接,但关键能力未就绪:${reason}`,
|
||||
textKey: "authority.mode.degraded",
|
||||
metaKey: "authority.mode.degraded.capabilityNotReady.meta",
|
||||
metaParams: { reason },
|
||||
level: "warning",
|
||||
reason,
|
||||
serverPrimaryReady,
|
||||
|
||||
Reference in New Issue
Block a user