fix: capability.py _get_vendor_commit 只返回 commit hash(对齐 health.py)

capability.py 的 _get_vendor_commit() 和 health.py 之前有同样的 bug:
f.read().strip() 返回整个 VENDOR_COMMIT 文件内容,
导致 scan_capabilities() 上报给 bridge 的 vendor 字段是多行文本。
对齐为逐行 commit: 前缀解析。
This commit is contained in:
lidf 2026-07-01 15:40:31 +08:00
parent 64e2480da6
commit 37a26ac674

View File

@ -71,9 +71,17 @@ def _scan_mcp_servers() -> list[dict[str, str]]:
def _get_vendor_commit() -> str: def _get_vendor_commit() -> str:
"""读取 _vendor/VENDOR_COMMIT只返回 commit hash。
VENDOR_COMMIT 是多行标记文件source:/commit:/date:
只返回 commit: 行的值不是整个文件内容
"""
commit_file = os.path.join(mindcli._VENDOR_DIR, "VENDOR_COMMIT") commit_file = os.path.join(mindcli._VENDOR_DIR, "VENDOR_COMMIT")
try: try:
with open(commit_file) as f: with open(commit_file) as f:
return f.read().strip() for line in f:
if line.startswith("commit:"):
return line.split(":", 1)[1].strip()
return "unknown"
except FileNotFoundError: except FileNotFoundError:
return "unknown" return "unknown"