docs: 恢复文档 — zhiyid max_tokens 修复交接(2026-08-17 单位网络中断)

状态: 织忆蒸馏=llama-3.1(NewAPI) 正常, 其他全切Agnes
卡点: Gitea源码不可达(frp隧道通但家里服务器服务没跑)
回家步骤: 局域网clone → 改max_tokens → 编译 → 部署 → 切回Agnes → 验证
This commit is contained in:
小唯 A06 2026-08-18 01:05:18 +08:00
parent 1b85cbc2ad
commit cb195593d1
1 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,61 @@
# 恢复文档zhiyid max_tokens 修复2026-08-17 晚 单位网络 中断)
> 牧尘带电脑回家后继续修复。本文件是完整交接状态。
## 任务目标
改 zhiyid 源码 max_tokens 150→800让织忆蒸馏用上 Agnes 2.0-flash
(当前织忆只能委屈用 llama-3.1-8b因为 zhiyid 二进制 max_tokens=150 硬编码,
Agnes 是推理模型会截断 JSON → parse error → 蒸馏退化 fallback
## 当前已落地状态(全部实测)
| 组件 | 模型 | 状态 |
|------|------|------|
| 织忆蒸馏 zhiyid | llama-3.1-8bNewAPI| ✅ 正常LLM entities:4 facts:2|
| TencentDB L1 | agnes-2.0-flash | ✅ extracted=1 stored=1 |
| daemon 持久意识 | agnes-2.0-flash | ✅ 重启生效 |
| 11 个 cron 任务 | agnes-2.0-flash | ✅ 全部确认 |
| 蒸馏看门狗 | 候选池 gemma 优先Agnes 移出)| ✅ 健康静默 |
| 巡检自愈 | 同上 | ✅ 语法+逻辑验证 |
## 卡点Gitea 源码不可达
- 单位网络访问 git.zszs.site → Nginx 404frp 隧道通,路由器 frpc 在线,
但家里服务器 192.168.123.11 上的服务没跑)
- 本机 frpc 已停(`sudo systemctl stop frpc`,避免和路由器冲突)
- 本机无 memoryweave 源码副本(/tmp/memoryweave 被清过,备份目录空)
## 回家后继续步骤
1. **确认局域网通**`curl http://192.168.123.11:3000`Gitea 局域网直连)
2. **拉源码**
```bash
cd /tmp && git clone http://192.168.123.11:3000/xiaoxue_admin/memoryweave.git
```
(如失败用 Gitea token9380e8e696662dfd93e1e0e60d64511e01bd0653
3. **改 max_tokens**`go/internal/distill/engine.go` 搜 `max_tokens`150→800
4. **编译**`cd go && go build -o zhiyid-new ./cmd/zhiyid`
5. **部署**
```bash
systemctl --user stop zhiyid
cp zhiyid-new /home/muc/bin/zhiyid-new
# zhiyid.service 切回 Agnes
# LLM_ENDPOINT=https://apihub.agnes-ai.com/v1/chat/completions
# LLM_API_BASE=https://apihub.agnes-ai.com/v1
# LLM_MODEL=agnes-2.0-flash
# LLM_API_KEY=<AGNES_KEY .env>
systemctl --user daemon-reload && systemctl --user start zhiyid
```
6. **验证**commit 测试 → journalctl 看 `LLM entities: N`N≥3 且无 parse error
7. **蒸馏候选池改回 Agnes 优先**distill-model-watchdog.py + model-health.py
CANDIDATE_POOL / distill_pool 把 agnes-2.0-flash 放最前(当前已移出)
8. **git 提交 + 更新 zhiyi skill**
## 关键文件/备份
- zhiyid.service`~/.config/systemd/user/zhiyid.service`(当前 llama-3.1+NewAPI
- tdai-gateway.yaml`~/.memory-tencentdb/memory-tdai/tdai-gateway.yaml`Agnes
- 备份zhiyid.service 无 bak手工改的tdai-gateway.yaml.bak-agnes 有
- 相关 git 提交2325b65Agnes接入、ed0e88b全面切Agnes、7d39171截断修复、becb3d0候选池回退
## 关键教训(已写入 zhiyi skill
- Agnes 2.0-flash 是推理模型max_tokens 150 里 99 是推理 token正文只有 51 → JSON 必截断
- 所有 JSON 探针必须 ≥500 tokens看门狗/巡检已改)
- 蒸馏专用必须非推理模型zhiyid max_tokens=150 限制)——除非改源码
- frp 诊断:`proxy already exists` = 路由器 frpc 在线隧道好404 = 目标服务挂了