1. fix seq reset.

2. remove SendMarkdown config
This commit is contained in:
aishannon 2026-03-15 19:15:13 +08:00
parent 6c394eaf0a
commit b67473e66e
2 changed files with 5 additions and 4 deletions

View file

@ -37,7 +37,7 @@ const (
dedupInterval = 60 * time.Second dedupInterval = 60 * time.Second
dedupMaxSize = 10000 // hard cap on dedup map entries dedupMaxSize = 10000 // hard cap on dedup map entries
typingResend = 8 * time.Second typingResend = 8 * time.Second
typingSeconds = 20 typingSeconds = 10
) )
var emojiRegexp = regexp.MustCompile(`<[^<]*?ext="([^"]+)"[^<]*?faceType=(\d+)[^<]*?>|<[^<]*?faceType=(\d+)[^<]*?ext="([^"]+)"[^<]*?>`) var emojiRegexp = regexp.MustCompile(`<[^<]*?ext="([^"]+)"[^<]*?faceType=(\d+)[^<]*?>|<[^<]*?faceType=(\d+)[^<]*?ext="([^"]+)"[^<]*?>`)
@ -57,6 +57,8 @@ type QQChannel struct {
// Passive reply: store last inbound message ID per chat. // Passive reply: store last inbound message ID per chat.
lastMsgID sync.Map // chatID → string lastMsgID sync.Map // chatID → string
// 消息回复时API时的SEQ用于回复时去重
// 被动回复: 同一个chatID+replyMsgID+seq 去重。 主动回复:不限制。
replySeq atomic.Uint32 replySeq atomic.Uint32
seqLock sync.Mutex seqLock sync.Mutex
@ -248,9 +250,9 @@ func (c *QQChannel) getReplyExtInfo(ctx context.Context, chatID string) (replyID
defer c.seqLock.Unlock() defer c.seqLock.Unlock()
seq = c.replySeq.Add(1) seq = c.replySeq.Add(1)
if seq > math.MaxInt32 { if seq > math.MaxInt32 {
c.replySeq.Store(1) c.replySeq.Store(0)
seq = c.replySeq.Add(1)
} }
return replyID, seq return replyID, seq
} }

View file

@ -353,7 +353,6 @@ type QQConfig struct {
AllowFrom FlexibleStringSlice `json:"allow_from" env:"PICOCLAW_CHANNELS_QQ_ALLOW_FROM"` AllowFrom FlexibleStringSlice `json:"allow_from" env:"PICOCLAW_CHANNELS_QQ_ALLOW_FROM"`
GroupTrigger GroupTriggerConfig `json:"group_trigger,omitempty"` GroupTrigger GroupTriggerConfig `json:"group_trigger,omitempty"`
MaxMessageLength int `json:"max_message_length" env:"PICOCLAW_CHANNELS_QQ_MAX_MESSAGE_LENGTH"` MaxMessageLength int `json:"max_message_length" env:"PICOCLAW_CHANNELS_QQ_MAX_MESSAGE_LENGTH"`
SendMarkdown bool `json:"send_markdown" env:"PICOCLAW_CHANNELS_QQ_SEND_MARKDOWN"`
ReasoningChannelID string `json:"reasoning_channel_id" env:"PICOCLAW_CHANNELS_QQ_REASONING_CHANNEL_ID"` ReasoningChannelID string `json:"reasoning_channel_id" env:"PICOCLAW_CHANNELS_QQ_REASONING_CHANNEL_ID"`
} }