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" }