refactor: cleanup redundant code

This commit is contained in:
Yiyang Kang 2023-03-20 21:45:59 +08:00
parent 9e7432a1a1
commit 89286b7e73
Signed by: kkyy
GPG key ID: 80FD317ECAF06CC3
3 changed files with 28 additions and 71 deletions

View file

@ -12,7 +12,7 @@ import (
tele "gopkg.in/telebot.v3"
)
var assistantWritingSign = "\n...📝"
var assistantWritingSign = "\n... 📝"
func matchAssistantConversation(botUsr *tele.User, msg *tele.Message) []*tele.Message {
// A thread must meet the following conditions to be considered a conversation with the assistant (for now):
@ -227,11 +227,7 @@ func handleAssistantConversation(c tele.Context, thread []*tele.Message) error {
MaxTokens: 2048,
}
typingNotifyCh := make(chan struct{})
go func() {
defer close(typingNotifyCh)
_ = c.Bot().Notify(lastMsg.Chat, tele.Typing)
}()
typingNotifyCh := setTyping(c)
var replyMsg *tele.Message
reqErr := assistantStreamedResponse(req, func(text string, finished bool) error {