This commit is contained in:
Ubuntu 2023-02-24 20:17:38 +08:00
parent bf342ff027
commit f17fc31813
4 changed files with 7 additions and 3 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ local/config.yaml
token.json token.json
wechatbot wechatbot
wechatbot.exe wechatbot.exe
run.log

View File

@ -91,13 +91,13 @@ func StartTelegramBot() {
} }
msg := tgbotapi.NewMessage(chatID, *reply) msg := tgbotapi.NewMessage(chatID, *reply)
send, err := bot.Send(msg) _, err := bot.Send(msg)
if err != nil { if err != nil {
log.Errorf("发送消息出错:%s", err.Error()) log.Errorf("发送消息出错:%s", err.Error())
continue continue
} }
log.Info("回答:", send.Text) log.Info("回答:", *reply)
} }
select {} select {}

View File

@ -135,6 +135,5 @@ func Completions(msg string) (*string, error) {
reply = gptErrorBody.Error["message"].(string) reply = gptErrorBody.Error["message"].(string)
} }
log.Debugf("gpt response full text: %s \n", reply)
return &reply, nil return &reply, nil
} }

4
run.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
basepath=$(cd `dirname $0`; pwd)
nohup ./wechatbot >> $basepath/run.log &