add wechat env 🚀

This commit is contained in:
Evan 2022-12-14 15:59:16 +09:00
parent 677cafaaa0
commit b548ce9693
3 changed files with 5 additions and 1 deletions

View File

@ -67,6 +67,7 @@ docker run -d --name wechatgpt -e apiKey="你的chatgpt apiKey" -e wechat="触
docker run -d --name wechatgpt -e apiKey="你的chatgpt apiKey" -e wechat="触发关键字" xiaomoinfo/wechatgpt-amd64:latest
```
<img src="screenshots/docker部署.png" alt="drawing" style="width:250px;"/>
### 微信

View File

@ -3,9 +3,9 @@ package wechat
import (
"fmt"
"github.com/eatmoreapple/openwechat"
log "github.com/sirupsen/logrus"
"github.com/wechatgpt/wechatbot/config"
"github.com/wechatgpt/wechatbot/openai"
"log"
"os"
"strings"
)
@ -37,6 +37,8 @@ func (gmh *GroupMessageHandler) ReplyText(msg *openwechat.Message) error {
appConfig := config.GetConfig()
if appConfig != nil {
keyword = appConfig.ChatGpt.Keyword
} else {
keyword = "chatgpt"
}
}
@ -48,6 +50,7 @@ func (gmh *GroupMessageHandler) ReplyText(msg *openwechat.Message) error {
return nil
}
requestText := strings.TrimSpace(splitItems[1])
log.Println("问题:%s", requestText)
reply, err := openai.Completions(requestText)
if err != nil {
log.Println(err)

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB