chore(scripts): 腾讯db彻底退役 — MEMORY_RECALL_SPEC.md 归档 .archive/,移除 memory-system-check/self-upgrade/distill-watchdog/model-health 全部腾讯db检测残留
This commit is contained in:
parent
0d6cecac62
commit
0bb65db27c
|
|
@ -2,7 +2,7 @@
|
|||
"""
|
||||
distill-model-watchdog.py — 蒸馏模型看门狗(30min 轻量探针)
|
||||
============================================================
|
||||
守护对象: 织忆 distill (zhiyid.service LLM_MODEL) + TencentDB L1 (tdai-gateway.yaml model)
|
||||
守护对象: 织忆 distill (zhiyid.service LLM_MODEL)
|
||||
|
||||
为什么需要:
|
||||
- model-health.py 每 6h 才跑,免费模型挂了要等半天
|
||||
|
|
@ -43,7 +43,6 @@ for _l in open(os.path.expanduser("~/.hermes/.env"), encoding="utf-8"):
|
|||
if _l.startswith("SENSENOVA_API_KEY=") and not _l.startswith("#"):
|
||||
SENSENOVA_KEY = _l.strip().split("=", 1)[1]
|
||||
ZHIYID_SERVICE = os.path.expanduser("~/.config/systemd/user/zhiyid.service")
|
||||
TDDB_CONFIG = os.path.expanduser("~/.memory-tencentdb/memory-tdai/tdai-gateway.yaml")
|
||||
FEISHU_WEBHOOK = "https://open.feishu.cn/open-apis/bot/v2/hook/446db983-e392-4d2c-bfb8-f9060e5df3ad"
|
||||
|
||||
# 候选池(优先级降序,2026-08-29 更新:本地 7B 首选,云 API 兜底)
|
||||
|
|
@ -189,10 +188,6 @@ def _update_zhiyid(model: str) -> bool:
|
|||
print(f" ❌ 更新 zhiyid.service 失败: {e}")
|
||||
return False
|
||||
|
||||
def _update_tddb(model: str) -> bool:
|
||||
"""TencentDB 已退役(2026-09-05),tdai-gateway 停用,永不更新。"""
|
||||
return False
|
||||
|
||||
def _feishu_alert(title: str, content: str):
|
||||
"""飞书告警卡片"""
|
||||
try:
|
||||
|
|
@ -261,15 +256,12 @@ def main():
|
|||
print(msg)
|
||||
return
|
||||
|
||||
# 3. 更新两处配置
|
||||
# 3. 更新配置
|
||||
z_ok = _update_zhiyid(replacement)
|
||||
t_ok = _update_tddb(replacement)
|
||||
|
||||
changed_parts = []
|
||||
if z_ok:
|
||||
changed_parts.append("zhiyid.service")
|
||||
if t_ok:
|
||||
changed_parts.append("tdai-gateway.yaml")
|
||||
|
||||
msg = f"**🔄 蒸馏模型已自动切换**\n\n⏰ {ts}\n`{current}` → `{replacement}`\n更新: {', '.join(changed_parts) if changed_parts else '无(配置已是最新)'}\n\n原因: 原模型 JSON 输出失败(免费模型挂了)"
|
||||
_feishu_alert("🔄 蒸馏模型自动切换", msg)
|
||||
|
|
|
|||
|
|
@ -130,14 +130,6 @@ for c in d.get('cares', []):
|
|||
fi
|
||||
}
|
||||
|
||||
# ── L3/L4 TencentDB(已退役 2026-09-05,跳过)─────────────
|
||||
check_tddb() {
|
||||
# 2026-09-05 TencentDB 退役:tdai-gateway disabled、8420 释放、数据归档 .memory-tencentdb.archive-20260905
|
||||
# daemon.py TDDB_ENABLED=False 短路,self-upgrade 跳过。此处不再检查,避免每小时假告警。
|
||||
log "[SKIP] TencentDB: 已退役 2026-09-05,不再自检"
|
||||
}
|
||||
|
||||
|
||||
# ── CBM 代码记忆 ──────────────────────────────────────────────
|
||||
check_cbm() {
|
||||
local ok=true
|
||||
|
|
@ -187,7 +179,6 @@ log "=== 记忆系统统一自检 $(date '+%Y-%m-%d %H:%M') ==="
|
|||
check_unified_layer
|
||||
check_zhiyi
|
||||
check_soulful
|
||||
check_tddb
|
||||
check_cbm
|
||||
|
||||
# ── 告警 ─────────────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ memory-system-self-upgrade.py — 记忆系统自我升级(方案A统一架构
|
|||
1. L7 llm_context.json v2:验证 9 字段完整,distill_status 检查
|
||||
2. 织忆(L1/L2):健康度 + pattern 节点增长 + 索引
|
||||
3. Soulful(L5/L6):过期 cares 清理 + distilled_rules 补充 + 心迹去重
|
||||
4. TencentDB(L3/L4):capture 写入验证 + 数据量报告
|
||||
5. 统一写入优化报告到飞书
|
||||
4. 统一写入优化报告到飞书
|
||||
"""
|
||||
import json, os, sys, subprocess
|
||||
from datetime import datetime, timezone, timedelta
|
||||
|
|
@ -16,7 +15,6 @@ from datetime import datetime, timezone, timedelta
|
|||
HERMES = os.path.expanduser("~/.hermes")
|
||||
ZHIYI_URL = "http://127.0.0.1:7821"
|
||||
ZHIYI_KEY = "zhiyi-dev-key-2026"
|
||||
TDDB_URL = "http://127.0.0.1:8420"
|
||||
FEISHU_WEBHOOK = "https://open.feishu.cn/open-apis/bot/v2/hook/446db983-e392-4d2c-bfb8-f9060e5df3ad"
|
||||
REPORT = [] # 收集升级报告
|
||||
|
||||
|
|
@ -207,7 +205,6 @@ def upgrade_soulful():
|
|||
log(f" Soulful 升级动作: {actions or '无需操作'}")
|
||||
return actions
|
||||
|
||||
# ── 3. TencentDB 自我升级 ────────────────────────────────────────────────────
|
||||
# ── Phase 5: Consolidation 引擎 ─────────────────────────────────────────────
|
||||
def _consolidate_memories():
|
||||
"""
|
||||
|
|
@ -288,40 +285,6 @@ def _consolidate_memories():
|
|||
return triggers
|
||||
|
||||
|
||||
def upgrade_tddb():
|
||||
# TencentDB 已退役(2026-09-05):不再自检,返回空动作
|
||||
log("=== TencentDB 自检(已退役 2026-09-05,跳过)===")
|
||||
return []
|
||||
|
||||
# Health
|
||||
try:
|
||||
req = urllib.request.Request(f"{TDDB_URL}/health", method="GET")
|
||||
with urllib.request.urlopen(req, timeout=5) as resp:
|
||||
health = json.loads(resp.read().decode())
|
||||
log(f" status: {health.get('status')}")
|
||||
log(f" pipeline consumed: {health.get('pipeline_tasks', {}).get('consumed', '?')}")
|
||||
except Exception as e:
|
||||
REPORT.append(f"❌ TencentDB 健康检查失败: {e}")
|
||||
return actions
|
||||
|
||||
# L0/L1 count via search (total = L1 count; L0 not directly exposed)
|
||||
try:
|
||||
req = urllib.request.Request(
|
||||
f"{TDDB_URL}/search/memories",
|
||||
data=json.dumps({"query": "牧尘", "top_k": 3}).encode("utf-8"),
|
||||
headers={"Content-Type": "application/json"},
|
||||
method="POST"
|
||||
)
|
||||
with urllib.request.urlopen(req, timeout=5) as resp:
|
||||
result = json.loads(resp.read().decode())
|
||||
total = result.get("total", 0)
|
||||
log(f" total_memories={total}")
|
||||
actions.append(f"总记忆={total}")
|
||||
except Exception as e:
|
||||
REPORT.append(f"❌ TencentDB 数据量检查失败: {e}")
|
||||
|
||||
return actions
|
||||
|
||||
# ── 主流程 ──────────────────────────────────────────────────────────────────
|
||||
if __name__ == "__main__":
|
||||
log("记忆系统自我升级开始")
|
||||
|
|
@ -347,7 +310,6 @@ if __name__ == "__main__":
|
|||
all_actions = {}
|
||||
all_actions["织忆"] = upgrade_zhiyi()
|
||||
all_actions["Soulful"] = upgrade_soulful()
|
||||
all_actions["TencentDB"] = upgrade_tddb()
|
||||
all_actions["Consolidation"] = _consolidate_memories()
|
||||
|
||||
# 汇总报告
|
||||
|
|
|
|||
|
|
@ -891,7 +891,7 @@ def main():
|
|||
_heal_hardcoded_models()
|
||||
|
||||
# ============ 蒸馏模型自愈(2026-08-02 新增)============
|
||||
# 守护 zhiyid.service LLM_MODEL + tdai-gateway.yaml model(织忆 distill + TencentDB L1)
|
||||
# 守护 zhiyid.service LLM_MODEL(织忆 distill)
|
||||
# 注意:蒸馏需要 JSON 输出能力,不能只看"对话可用"——用 _verify_model_usable 之外
|
||||
# 还要确认模型不是 reasoning 型(content=null)。这里直接复用本脚本的探针结果:
|
||||
# 若配置中的模型在 results 里非 stable,或结果缺失(未测试),则用 JSON 能力复核后替换。
|
||||
|
|
@ -899,7 +899,6 @@ def main():
|
|||
def _heal_distill_models():
|
||||
import re as _re
|
||||
zhiyid_svc = os.path.expanduser("~/.config/systemd/user/zhiyid.service")
|
||||
tddb_cfg = os.path.expanduser("~/.memory-tencentdb/memory-tdai/tdai-gateway.yaml")
|
||||
if not os.path.exists(zhiyid_svc):
|
||||
return
|
||||
|
||||
|
|
@ -1027,10 +1026,6 @@ def main():
|
|||
except Exception as e:
|
||||
print(f" ❌ [蒸馏] 更新 zhiyid.service 失败: {e}")
|
||||
|
||||
# TencentDB 已退役(2026-09-05):tdai-gateway.yaml 不再更新
|
||||
if os.path.exists(tddb_cfg):
|
||||
print(f" [SKIP] tdai-gateway.yaml 已退役,跳过更新")
|
||||
|
||||
_heal_distill_models()
|
||||
|
||||
print(f"\n{'='*50}")
|
||||
|
|
|
|||
Loading…
Reference in New Issue