mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-07-30 14:25:00 +00:00
* fix(agent): use ChannelType in system prompt for proper channel context The system prompt was using the channel instance name (e.g. "zep-lao") instead of the platform type (e.g. "zalo_personal"), causing the LLM to not understand which messaging platform it's running on. This led to context confusion where the bot would ask users which channel to send to instead of using the current one. Changes: - Add ChannelType field to RunRequest and SystemPromptConfig - Thread channel type from consumer/cron → agent loop → system prompt - Add WithToolChannelType/ToolChannelTypeFromCtx for tool context - Register channel types for both config-based and DB-loaded instances - Fix Zalo group thread type detection with approvedGroups cache - Update cron handler to resolve channel type for cron-triggered runs * refactor(channels): add Type() to Channel interface, remove channelTypes map Move channel type from a separate map in Manager to the Channel interface itself. BaseChannel.Type() falls back to Name() for config-based channels where name == type. Extracts resolveChannelType helper to DRY up 6 repeated resolution blocks across consumer and cron handlers. * feat(zalo): add pending group history for conversation context Zalo personal groups now record non-@mentioned messages in a ring buffer (default 50, configurable via history_limit). When the bot IS mentioned, pending history is flushed as context — matching Telegram/Discord/Feishu. Separated mention gating from policy gating in checkGroupPolicy for cleaner control flow.