@hupan56/wlkj 3.3.18 → 3.3.19
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.
package/package.json
CHANGED
|
@@ -81,6 +81,21 @@ def say(tag, msg):
|
|
|
81
81
|
print('{} {}'.format(tag, msg))
|
|
82
82
|
|
|
83
83
|
|
|
84
|
+
def _detect_cloud_kg():
|
|
85
|
+
"""检测 kg MCP 是否走云平台 SSE url(共识:全走平台,不建本地 kg)。"""
|
|
86
|
+
try:
|
|
87
|
+
_mcp_f = os.path.join(os.path.expanduser('~'), '.qoderwork', 'mcp.json')
|
|
88
|
+
if os.path.isfile(_mcp_f):
|
|
89
|
+
import json as _j
|
|
90
|
+
_cfg = _j.loads(open(_mcp_f, encoding='utf-8').read())
|
|
91
|
+
_kg = (_cfg.get('mcpServers') or {}).get('qoder-knowledge-graph', {})
|
|
92
|
+
if _kg.get('url') or _kg.get('type') == 'sse':
|
|
93
|
+
return True
|
|
94
|
+
except Exception:
|
|
95
|
+
pass
|
|
96
|
+
return False
|
|
97
|
+
|
|
98
|
+
|
|
84
99
|
def problem(msg, hint=None):
|
|
85
100
|
issues.append(msg)
|
|
86
101
|
say(BAD, msg)
|
|
@@ -483,6 +498,9 @@ def print_degraded_status():
|
|
|
483
498
|
|
|
484
499
|
def check_index(fix):
|
|
485
500
|
print('\n--- 5. 知识图谱 (data/index/) ---')
|
|
501
|
+
if _detect_cloud_kg():
|
|
502
|
+
say(OK, '知识层走云平台 SSE(不依赖本地 kg.duckdb,平台有81241实体+43工具)')
|
|
503
|
+
return
|
|
486
504
|
age = index_age_days()
|
|
487
505
|
if age is None:
|
|
488
506
|
# 全迁 PG 后 kg.duckdb 废弃:环境配了 PG → 知识层在平台,不报缺失
|
|
@@ -553,8 +571,11 @@ def check_style(fix):
|
|
|
553
571
|
else:
|
|
554
572
|
problem(fname + ' 缺失', '该文件提交在 git 中, 先解决团队同步 (team_sync pull)')
|
|
555
573
|
|
|
556
|
-
# kg.duckdb 知识图谱
|
|
574
|
+
# kg.duckdb 知识图谱 — 全迁 PG 后知识层在平台,本地 duckdb 废弃
|
|
575
|
+
# ★ 共识:kg 走云 SSE 时也不检查本地
|
|
557
576
|
_pg_mode = os.environ.get('KNOWLEDGE_BACKEND', '').lower() == 'pg' or 'postgresql' in os.environ.get('DATABASE_URL', '')
|
|
577
|
+
if _detect_cloud_kg():
|
|
578
|
+
_pg_mode = True
|
|
558
579
|
kg_path = os.path.join(INDEX_DIR, 'kg.duckdb')
|
|
559
580
|
role = ''
|
|
560
581
|
try:
|