diff --git a/pkg/channels/wecom/app.go b/pkg/channels/wecom/app.go index 3a25e12e1..771603f3e 100644 --- a/pkg/channels/wecom/app.go +++ b/pkg/channels/wecom/app.go @@ -129,9 +129,12 @@ func NewWeComAppChannel(cfg config.WeComAppConfig, messageBus *bus.MessageBus) ( channels.WithReasoningChannelID(cfg.ReasoningChannelID), ) + ctx, cancel := context.WithCancel(context.Background()) return &WeComAppChannel{ BaseChannel: base, config: cfg, + ctx: ctx, + cancel: cancel, processedMsgs: make(map[string]bool), }, nil } diff --git a/pkg/channels/wecom/bot.go b/pkg/channels/wecom/bot.go index d904389f6..e99c710ef 100644 --- a/pkg/channels/wecom/bot.go +++ b/pkg/channels/wecom/bot.go @@ -93,9 +93,12 @@ func NewWeComBotChannel(cfg config.WeComConfig, messageBus *bus.MessageBus) (*We channels.WithReasoningChannelID(cfg.ReasoningChannelID), ) + ctx, cancel := context.WithCancel(context.Background()) return &WeComBotChannel{ BaseChannel: base, config: cfg, + ctx: ctx, + cancel: cancel, processedMsgs: make(map[string]bool), }, nil }