From f17fc31813a6bf05ec550b488a8983b15b9b3ea2 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 24 Feb 2023 20:17:38 +0800 Subject: [PATCH] update --- .gitignore | 1 + bootstrap/telegram.go | 4 ++-- openai/chatgpt.go | 1 - run.sh | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100755 run.sh diff --git a/.gitignore b/.gitignore index 24b30ca..47c54d8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ local/config.yaml token.json wechatbot wechatbot.exe +run.log diff --git a/bootstrap/telegram.go b/bootstrap/telegram.go index 6feed23..67d92f7 100644 --- a/bootstrap/telegram.go +++ b/bootstrap/telegram.go @@ -91,13 +91,13 @@ func StartTelegramBot() { } msg := tgbotapi.NewMessage(chatID, *reply) - send, err := bot.Send(msg) + _, err := bot.Send(msg) if err != nil { log.Errorf("发送消息出错:%s", err.Error()) continue } - log.Info("回答:", send.Text) + log.Info("回答:", *reply) } select {} diff --git a/openai/chatgpt.go b/openai/chatgpt.go index 2f3e66d..24d89cd 100644 --- a/openai/chatgpt.go +++ b/openai/chatgpt.go @@ -135,6 +135,5 @@ func Completions(msg string) (*string, error) { reply = gptErrorBody.Error["message"].(string) } - log.Debugf("gpt response full text: %s \n", reply) return &reply, nil } diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..738bf77 --- /dev/null +++ b/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash +basepath=$(cd `dirname $0`; pwd) + +nohup ./wechatbot >> $basepath/run.log &