remove old code

This commit is contained in:
unintendedfraud
2023-11-07 09:44:13 +01:00
parent cc982d5a64
commit b5c80d2633
2 changed files with 1 additions and 90 deletions
-13
View File
@@ -16,24 +16,15 @@ var messagesHistory = []*openai.ChatMessage{}
func OnMessageCreated(s *discordgo.Session, m *discordgo.MessageCreate) {
isHal := m.Author.ID == s.State.User.ID
fmt.Println("message received: ", m.Message.Content)
addMessageToHistory(m.Message, isHal)
fmt.Println("added message to history", len(messagesHistory))
if isHal {
return
}
fmt.Println("check contains user")
if containUser(m.Mentions, s.State.User.ID) {
fmt.Println("lets go")
aiclient := openai.NewClient(env.GetEnvVariables().OpenaiHalToken)
fmt.Println("client created")
res, err := aiclient.Chat(messagesHistory)
if err != nil {
sendResponse(
@@ -45,14 +36,10 @@ func OnMessageCreated(s *discordgo.Session, m *discordgo.MessageCreate) {
log.Panicf("failed to query open ai with the following prompt [%s]. Error: %s", m.Content, err.Error())
}
fmt.Println("Choices: ", res.Choices)
if len(res.Choices) > 0 {
aiResponse := res.Choices[0].Message.Content
sendResponse(s, m.ChannelID, aiResponse)
}
} else {
fmt.Println("hal not mentioned")
}
}