From 556d236c465ade5e3aaf04ae2ca9990fd571c4aa Mon Sep 17 00:00:00 2001 From: sushi30 Date: Sun, 29 Mar 2026 22:52:37 +0200 Subject: [PATCH] fix: lint cleanup and document group_trigger in example config Add group_trigger entries to all channels in config.example.json that support mention-only mode. Fix golines formatting in line.go, matrix.go, config.go, and suppress nilerr for intentional silent skip in observeMessage. Co-Authored-By: Claude Sonnet 4.6 --- config/config.example.json | 24 ++++++++++++++++++++++++ pkg/agent/loop.go | 2 +- pkg/channels/line/line.go | 4 +++- pkg/channels/matrix/matrix.go | 4 +++- pkg/config/config.go | 12 ++++++------ 5 files changed, 37 insertions(+), 9 deletions(-) diff --git a/config/config.example.json b/config/config.example.json index f0cce6d72..012b9de3c 100644 --- a/config/config.example.json +++ b/config/config.example.json @@ -95,6 +95,9 @@ "proxy": "", "allow_from": ["YOUR_USER_ID"], "use_markdown_v2": false, + "group_trigger": { + "mention_only": true + }, "reasoning_channel_id": "", "streaming": { "enabled": true @@ -115,6 +118,9 @@ "app_id": "YOUR_QQ_APP_ID", "app_secret": "YOUR_QQ_APP_SECRET", "allow_from": [], + "group_trigger": { + "mention_only": true + }, "reasoning_channel_id": "" }, "maixcam": { @@ -130,6 +136,9 @@ "use_native": false, "session_store_path": "", "allow_from": [], + "group_trigger": { + "mention_only": false + }, "reasoning_channel_id": "" }, "feishu": { @@ -139,6 +148,9 @@ "encrypt_key": "", "verification_token": "", "allow_from": [], + "group_trigger": { + "mention_only": true + }, "placeholder": { "enabled": true, "text": ["Thinking...", "Processing...", "Typing..."] @@ -152,6 +164,9 @@ "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET", "allow_from": [], + "group_trigger": { + "mention_only": true + }, "reasoning_channel_id": "" }, "slack": { @@ -159,6 +174,9 @@ "bot_token": "xoxb-YOUR-BOT-TOKEN", "app_token": "xapp-YOUR-APP-TOKEN", "allow_from": [], + "group_trigger": { + "mention_only": true + }, "reasoning_channel_id": "" }, "matrix": { @@ -186,6 +204,9 @@ "channel_access_token": "YOUR_LINE_CHANNEL_ACCESS_TOKEN", "webhook_path": "/webhook/line", "allow_from": [], + "group_trigger": { + "mention_only": true + }, "reasoning_channel_id": "" }, "onebot": { @@ -195,6 +216,9 @@ "reconnect_interval": 5, "group_trigger_prefix": [], "allow_from": [], + "group_trigger": { + "mention_only": true + }, "reasoning_channel_id": "" }, "wecom": { diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index fb7c1793f..9a8364b08 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -1448,7 +1448,7 @@ func (al *AgentLoop) observeMessage(ctx context.Context, msg bus.InboundMessage) "channel": msg.Channel, "error": err.Error(), }) - return "", nil + return "", nil //nolint:nilerr // route resolution failure is not an error for observe-only messages } sessionKey := resolveScopeKey(route, msg.SessionKey) diff --git a/pkg/channels/line/line.go b/pkg/channels/line/line.go index f4fa05abe..cabe325e0 100644 --- a/pkg/channels/line/line.go +++ b/pkg/channels/line/line.go @@ -367,7 +367,9 @@ func (c *LINEChannel) processEvent(event lineEvent) { "platform": "line", "source_type": event.Source.Type, } - c.ObserveGroupMessage(c.ctx, observePeer, msg.ID, senderID, chatID, content, mediaPaths, observeMeta, observeSender) + c.ObserveGroupMessage( + c.ctx, observePeer, msg.ID, senderID, chatID, content, mediaPaths, observeMeta, observeSender, + ) return } content = cleaned diff --git a/pkg/channels/matrix/matrix.go b/pkg/channels/matrix/matrix.go index bfe71c6ae..e86e60ea3 100644 --- a/pkg/channels/matrix/matrix.go +++ b/pkg/channels/matrix/matrix.go @@ -728,7 +728,9 @@ func (c *MatrixChannel) handleMessageEvent(ctx context.Context, evt *event.Event "room_id": roomID, "platform": "matrix", } - c.ObserveGroupMessage(ctx, observePeer, evt.ID.String(), senderID, roomID, content, mediaPaths, observeMeta, sender) + c.ObserveGroupMessage( + ctx, observePeer, evt.ID.String(), senderID, roomID, content, mediaPaths, observeMeta, sender, + ) return } content = cleaned diff --git a/pkg/config/config.go b/pkg/config/config.go index 7cb9fcf7f..54acf79ef 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -353,13 +353,13 @@ type StreamingConfig struct { } type WhatsAppConfig struct { - Enabled bool `json:"enabled" yaml:"-" env:"PICOCLAW_CHANNELS_WHATSAPP_ENABLED"` - BridgeURL string `json:"bridge_url" yaml:"-" env:"PICOCLAW_CHANNELS_WHATSAPP_BRIDGE_URL"` - UseNative bool `json:"use_native" yaml:"-" env:"PICOCLAW_CHANNELS_WHATSAPP_USE_NATIVE"` - SessionStorePath string `json:"session_store_path" yaml:"-" env:"PICOCLAW_CHANNELS_WHATSAPP_SESSION_STORE_PATH"` - AllowFrom FlexibleStringSlice `json:"allow_from" yaml:"-" env:"PICOCLAW_CHANNELS_WHATSAPP_ALLOW_FROM"` + Enabled bool `json:"enabled" yaml:"-" env:"PICOCLAW_CHANNELS_WHATSAPP_ENABLED"` + BridgeURL string `json:"bridge_url" yaml:"-" env:"PICOCLAW_CHANNELS_WHATSAPP_BRIDGE_URL"` + UseNative bool `json:"use_native" yaml:"-" env:"PICOCLAW_CHANNELS_WHATSAPP_USE_NATIVE"` + SessionStorePath string `json:"session_store_path" yaml:"-" env:"PICOCLAW_CHANNELS_WHATSAPP_SESSION_STORE_PATH"` + AllowFrom FlexibleStringSlice `json:"allow_from" yaml:"-" env:"PICOCLAW_CHANNELS_WHATSAPP_ALLOW_FROM"` GroupTrigger GroupTriggerConfig `json:"group_trigger,omitempty" yaml:"-"` - ReasoningChannelID string `json:"reasoning_channel_id" yaml:"-" env:"PICOCLAW_CHANNELS_WHATSAPP_REASONING_CHANNEL_ID"` + ReasoningChannelID string `json:"reasoning_channel_id" yaml:"-" env:"PICOCLAW_CHANNELS_WHATSAPP_REASONING_CHANNEL_ID"` } type TelegramConfig struct {