package coordinator import ( "os" "strings" "sync" ) // 意图叙述开关:默认开启。关闭后查询/帮助/结果通报全部回到确定性模板。 var ( replyFlagMu sync.RWMutex agentReplyLLMOn = envAgentReplyLLM() ) func envAgentReplyLLM() bool { v := strings.TrimSpace(os.Getenv("AGENT_REPLY_LLM_ENABLED")) if v == "" { return true } return v == "1" || strings.EqualFold(v, "true") || strings.EqualFold(v, "yes") } // agentReplyLLMEnabled 报告意图叙述是否走智能体。 func agentReplyLLMEnabled() bool { replyFlagMu.RLock() defer replyFlagMu.RUnlock() return agentReplyLLMOn } // SetAgentReplyLLMForTest 测试专用覆盖,返回恢复函数。 func SetAgentReplyLLMForTest(enabled bool) func() { replyFlagMu.Lock() prev := agentReplyLLMOn agentReplyLLMOn = enabled replyFlagMu.Unlock() return func() { replyFlagMu.Lock() agentReplyLLMOn = prev replyFlagMu.Unlock() } }