wechatgpt/handler/telegram/telegram.go
2022-12-12 20:35:08 +09:00

22 lines
429 B
Go

package telegram
import (
log "github.com/sirupsen/logrus"
"github.com/wechatgpt/wechatbot/config"
"github.com/wechatgpt/wechatbot/openai"
"strings"
)
func Handle(msg string) *string {
appConfig := config.GetConfig()
if appConfig == nil {
return nil
}
requestText := strings.TrimSpace(msg)
reply, err := openai.Completions(requestText, appConfig.ChatGpt.Token)
if err != nil {
log.Println(err)
}
return reply
}