微信恢复优化

This commit is contained in:
Evan 2022-12-13 17:11:20 +09:00
parent e95e248842
commit c11cc18ab5

View File

@ -56,6 +56,18 @@ func (gmh *GroupMessageHandler) ReplyText(msg *openwechat.Message) error {
log.Println(text)
return err
}
// 如果在提问的时候没有包含?,AI会自动在开头补充个看起来很奇怪
result := *reply
if strings.HasPrefix(result, "?") {
result = strings.Replace(result, "?", "", -1)
}
if strings.HasPrefix(result, "") {
result = strings.Replace(result, "", "", -1)
}
// 微信不支持markdown格式所以把反引号直接去掉
if strings.HasPrefix(result, "`") {
result = strings.Replace(result, "`", "", -1)
}
if reply != nil {
_, err = msg.ReplyText(*reply)