add wechat env 🚀
This commit is contained in:
parent
677cafaaa0
commit
b548ce9693
@ -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
|
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;"/>
|
||||||
|
|
||||||
### 微信
|
### 微信
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@ package wechat
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/eatmoreapple/openwechat"
|
"github.com/eatmoreapple/openwechat"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/wechatgpt/wechatbot/config"
|
"github.com/wechatgpt/wechatbot/config"
|
||||||
"github.com/wechatgpt/wechatbot/openai"
|
"github.com/wechatgpt/wechatbot/openai"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -37,6 +37,8 @@ func (gmh *GroupMessageHandler) ReplyText(msg *openwechat.Message) error {
|
|||||||
appConfig := config.GetConfig()
|
appConfig := config.GetConfig()
|
||||||
if appConfig != nil {
|
if appConfig != nil {
|
||||||
keyword = appConfig.ChatGpt.Keyword
|
keyword = appConfig.ChatGpt.Keyword
|
||||||
|
} else {
|
||||||
|
keyword = "chatgpt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +50,7 @@ func (gmh *GroupMessageHandler) ReplyText(msg *openwechat.Message) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
requestText := strings.TrimSpace(splitItems[1])
|
requestText := strings.TrimSpace(splitItems[1])
|
||||||
|
log.Println("问题:%s", requestText)
|
||||||
reply, err := openai.Completions(requestText)
|
reply, err := openai.Completions(requestText)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
BIN
screenshots/docker部署.png
Normal file
BIN
screenshots/docker部署.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 336 KiB |
Loading…
x
Reference in New Issue
Block a user