From c11cc18ab5b5b36644a23c0d01a72a2c579935bb Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 13 Dec 2022 17:11:20 +0900 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=81=A2=E5=A4=8D=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/wechat/wechat_handler.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/handler/wechat/wechat_handler.go b/handler/wechat/wechat_handler.go index 63d50b4..17f2322 100644 --- a/handler/wechat/wechat_handler.go +++ b/handler/wechat/wechat_handler.go @@ -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)