mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-06 16:57:29 +08:00
autonomy notify: remove notify_channel/chat_id config and always derive target from enabled channel allow_from
This commit is contained in:
@@ -938,14 +938,7 @@ func buildHeartbeatService(cfg *config.Config, msgBus *bus.MessageBus) *heartbea
|
|||||||
|
|
||||||
func buildAutonomyEngine(cfg *config.Config, msgBus *bus.MessageBus) *autonomy.Engine {
|
func buildAutonomyEngine(cfg *config.Config, msgBus *bus.MessageBus) *autonomy.Engine {
|
||||||
a := cfg.Agents.Defaults.Autonomy
|
a := cfg.Agents.Defaults.Autonomy
|
||||||
notifyChannel := strings.ToLower(strings.TrimSpace(a.NotifyChannel))
|
notifyChannel, notifyChatID := inferAutonomyNotifyTarget(cfg)
|
||||||
notifyChatID := strings.TrimSpace(a.NotifyChatID)
|
|
||||||
if notifyChannel == "" || notifyChatID == "" {
|
|
||||||
if ch, chat := inferAutonomyNotifyTarget(cfg); ch != "" && chat != "" {
|
|
||||||
notifyChannel = ch
|
|
||||||
notifyChatID = chat
|
|
||||||
}
|
|
||||||
}
|
|
||||||
notifyAllowFrom := []string{}
|
notifyAllowFrom := []string{}
|
||||||
switch notifyChannel {
|
switch notifyChannel {
|
||||||
case "telegram":
|
case "telegram":
|
||||||
|
|||||||
@@ -27,9 +27,7 @@
|
|||||||
"max_rounds_without_user": 12,
|
"max_rounds_without_user": 12,
|
||||||
"task_history_retention_days": 3,
|
"task_history_retention_days": 3,
|
||||||
"waiting_resume_debounce_sec": 5,
|
"waiting_resume_debounce_sec": 5,
|
||||||
"allowed_task_keywords": [],
|
"allowed_task_keywords": []
|
||||||
"notify_channel": "",
|
|
||||||
"notify_chat_id": ""
|
|
||||||
},
|
},
|
||||||
"texts": {
|
"texts": {
|
||||||
"no_response_fallback": "I've completed processing but have no response to give.",
|
"no_response_fallback": "I've completed processing but have no response to give.",
|
||||||
|
|||||||
@@ -59,8 +59,6 @@ type AutonomyConfig struct {
|
|||||||
TaskHistoryRetentionDays int `json:"task_history_retention_days" env:"CLAWGO_AGENTS_DEFAULTS_AUTONOMY_TASK_HISTORY_RETENTION_DAYS"`
|
TaskHistoryRetentionDays int `json:"task_history_retention_days" env:"CLAWGO_AGENTS_DEFAULTS_AUTONOMY_TASK_HISTORY_RETENTION_DAYS"`
|
||||||
WaitingResumeDebounceSec int `json:"waiting_resume_debounce_sec" env:"CLAWGO_AGENTS_DEFAULTS_AUTONOMY_WAITING_RESUME_DEBOUNCE_SEC"`
|
WaitingResumeDebounceSec int `json:"waiting_resume_debounce_sec" env:"CLAWGO_AGENTS_DEFAULTS_AUTONOMY_WAITING_RESUME_DEBOUNCE_SEC"`
|
||||||
AllowedTaskKeywords []string `json:"allowed_task_keywords" env:"CLAWGO_AGENTS_DEFAULTS_AUTONOMY_ALLOWED_TASK_KEYWORDS"`
|
AllowedTaskKeywords []string `json:"allowed_task_keywords" env:"CLAWGO_AGENTS_DEFAULTS_AUTONOMY_ALLOWED_TASK_KEYWORDS"`
|
||||||
NotifyChannel string `json:"notify_channel" env:"CLAWGO_AGENTS_DEFAULTS_AUTONOMY_NOTIFY_CHANNEL"`
|
|
||||||
NotifyChatID string `json:"notify_chat_id" env:"CLAWGO_AGENTS_DEFAULTS_AUTONOMY_NOTIFY_CHAT_ID"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type AgentTextConfig struct {
|
type AgentTextConfig struct {
|
||||||
@@ -330,8 +328,6 @@ func DefaultConfig() *Config {
|
|||||||
TaskHistoryRetentionDays: 3,
|
TaskHistoryRetentionDays: 3,
|
||||||
WaitingResumeDebounceSec: 5,
|
WaitingResumeDebounceSec: 5,
|
||||||
AllowedTaskKeywords: []string{},
|
AllowedTaskKeywords: []string{},
|
||||||
NotifyChannel: "",
|
|
||||||
NotifyChatID: "",
|
|
||||||
},
|
},
|
||||||
Texts: AgentTextConfig{
|
Texts: AgentTextConfig{
|
||||||
NoResponseFallback: "I've completed processing but have no response to give.",
|
NoResponseFallback: "I've completed processing but have no response to give.",
|
||||||
|
|||||||
Reference in New Issue
Block a user