mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-14 20:47:30 +08:00
p0 dedupe tune: configurable dedupe windows, include buttons in outbound idempotency key, and add regression coverage
This commit is contained in:
@@ -127,13 +127,16 @@ type ContextCompactionConfig struct {
|
||||
}
|
||||
|
||||
type ChannelsConfig struct {
|
||||
WhatsApp WhatsAppConfig `json:"whatsapp"`
|
||||
Telegram TelegramConfig `json:"telegram"`
|
||||
Feishu FeishuConfig `json:"feishu"`
|
||||
Discord DiscordConfig `json:"discord"`
|
||||
MaixCam MaixCamConfig `json:"maixcam"`
|
||||
QQ QQConfig `json:"qq"`
|
||||
DingTalk DingTalkConfig `json:"dingtalk"`
|
||||
InboundMessageIDDedupeTTLSeconds int `json:"inbound_message_id_dedupe_ttl_seconds" env:"CLAWGO_CHANNELS_INBOUND_MESSAGE_ID_DEDUPE_TTL_SECONDS"`
|
||||
InboundContentDedupeWindowSeconds int `json:"inbound_content_dedupe_window_seconds" env:"CLAWGO_CHANNELS_INBOUND_CONTENT_DEDUPE_WINDOW_SECONDS"`
|
||||
OutboundDedupeWindowSeconds int `json:"outbound_dedupe_window_seconds" env:"CLAWGO_CHANNELS_OUTBOUND_DEDUPE_WINDOW_SECONDS"`
|
||||
WhatsApp WhatsAppConfig `json:"whatsapp"`
|
||||
Telegram TelegramConfig `json:"telegram"`
|
||||
Feishu FeishuConfig `json:"feishu"`
|
||||
Discord DiscordConfig `json:"discord"`
|
||||
MaixCam MaixCamConfig `json:"maixcam"`
|
||||
QQ QQConfig `json:"qq"`
|
||||
DingTalk DingTalkConfig `json:"dingtalk"`
|
||||
}
|
||||
|
||||
type WhatsAppConfig struct {
|
||||
@@ -386,6 +389,9 @@ func DefaultConfig() *Config {
|
||||
},
|
||||
},
|
||||
Channels: ChannelsConfig{
|
||||
InboundMessageIDDedupeTTLSeconds: 600,
|
||||
InboundContentDedupeWindowSeconds: 12,
|
||||
OutboundDedupeWindowSeconds: 12,
|
||||
WhatsApp: WhatsAppConfig{
|
||||
Enabled: false,
|
||||
BridgeURL: "ws://localhost:3001",
|
||||
|
||||
@@ -260,6 +260,15 @@ func Validate(cfg *Config) []error {
|
||||
errs = append(errs, fmt.Errorf("memory.recent_days must be > 0"))
|
||||
}
|
||||
|
||||
if cfg.Channels.InboundMessageIDDedupeTTLSeconds <= 0 {
|
||||
errs = append(errs, fmt.Errorf("channels.inbound_message_id_dedupe_ttl_seconds must be > 0"))
|
||||
}
|
||||
if cfg.Channels.InboundContentDedupeWindowSeconds <= 0 {
|
||||
errs = append(errs, fmt.Errorf("channels.inbound_content_dedupe_window_seconds must be > 0"))
|
||||
}
|
||||
if cfg.Channels.OutboundDedupeWindowSeconds <= 0 {
|
||||
errs = append(errs, fmt.Errorf("channels.outbound_dedupe_window_seconds must be > 0"))
|
||||
}
|
||||
if cfg.Channels.Telegram.Enabled && cfg.Channels.Telegram.Token == "" {
|
||||
errs = append(errs, fmt.Errorf("channels.telegram.token is required when channels.telegram.enabled=true"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user