From 3cf3858f09d573e1dc91ddc8f9f9b132167b15be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=80=A1?= Date: Mon, 26 Oct 2026 10:56:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(peer):=20=E7=94=BB=E5=83=8F=E6=8E=A8?= =?UTF-8?q?=E7=90=86=E5=99=A8=E6=94=AF=E6=8C=81=20peer=20=E4=B8=93?= =?UTF-8?q?=E7=94=A8=20LLM=20=E7=AB=AF=E7=82=B9=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E8=A2=AB=E5=85=A8=E5=B1=80=20LLM=5FENDPOINT=20=E6=8B=96?= =?UTF-8?q?=E5=8E=BB=E9=89=B4=E6=9D=83=E8=85=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 起因 t_a5ef04a5:zhiyid 的 LLM_ENDPOINT 由 90-llm.conf 定为 newapi 3000 + agnes-2.5-flash (供蒸馏/skillgen/consolidate 共用),而 NewLocal2BReasoner 按设计不发 Authorization ⇒ peer refresh 必然 401、peers 表恒 0 行、peer 召回零产出。 不采用卡面建议的「把全局 LLM_ENDPOINT 改成 8081」——那会把蒸馏同时降级成 2B。 改法:新增 ZHIYI_PEER_LLM_ENDPOINT / ZHIYI_PEER_LLM_MODEL 优先读取,未设时行为与改动前逐位一致。 回滚:删 91-peer-llm.conf 即恢复旧行为。 --- go/internal/peer/reasoner.go | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/go/internal/peer/reasoner.go b/go/internal/peer/reasoner.go index aa68dc7..433f5cc 100644 --- a/go/internal/peer/reasoner.go +++ b/go/internal/peer/reasoner.go @@ -19,10 +19,17 @@ import ( ) // Local2BReasoner 用本地 2B 生成四层推理画像。 -// env:LLM_ENDPOINT(默认 http://127.0.0.1:8081/v1/chat/completions) // -// LLM_MODEL (默认 local/minicpm5-2b) +// env 查找顺序(2026-10-26 加前两项,起因 t_a5ef04a5): +// +// ZHIYI_PEER_LLM_ENDPOINT(peer 专用,优先)→ LLM_ENDPOINT → 默认 8081 本地 2B +// ZHIYI_PEER_LLM_MODEL (peer 专用,优先)→ LLM_MODEL → 默认 local/minicpm5-2b // LLM_TIMEOUT (默认 120s) +// +// 为什么要 peer 专用变量:LLM_ENDPOINT 是**全进程共享**的(蒸馏 llm_judge、 +// adversarial_audit、skillgen、consolidate client 都读它,见 server.go:230)。 +// 把全局指向 8081 会把蒸馏从 agnes-2.5-flash 顺手降级成 2B;而 newapi(3000) +// 需要鉴权、本 reasoner 按设计不发 Authorization ⇒ 必然 401。故只给 peer 开专用口子。 type Local2BReasoner struct { endpoint string model string @@ -32,11 +39,17 @@ type Local2BReasoner struct { // NewLocal2BReasoner 读 env 构造本地 2B 推理器。 func NewLocal2BReasoner() *Local2BReasoner { - endpoint := os.Getenv("LLM_ENDPOINT") + endpoint := os.Getenv("ZHIYI_PEER_LLM_ENDPOINT") + if endpoint == "" { + endpoint = os.Getenv("LLM_ENDPOINT") + } if endpoint == "" { endpoint = "http://127.0.0.1:8081/v1/chat/completions" } - model := os.Getenv("LLM_MODEL") + model := os.Getenv("ZHIYI_PEER_LLM_MODEL") + if model == "" { + model = os.Getenv("LLM_MODEL") + } if model == "" { model = "local/minicpm5-2b" }