mirror of https://github.com/velour/catbase.git
Compare commits
No commits in common. "494c9e87d6fe992d441fe456c16f0289ffcc3df5" and "0b787a65a1d2ebad241120a45f3e8452cd42f201" have entirely different histories.
494c9e87d6
...
0b787a65a1
|
@ -7,10 +7,10 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.21
|
||||
- name: Set up Go 1.18
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.21.x
|
||||
go-version: 1.18.x
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
|
|
|
@ -106,7 +106,7 @@ func (c *Config) GetString(key, fallback string) string {
|
|||
q := `select value from config where key=?`
|
||||
err := c.DB.Get(&configValue, q, key)
|
||||
if err != nil {
|
||||
log.Info().Msgf("WARN: Key %s is empty", key)
|
||||
log.Debug().Msgf("WARN: Key %s is empty", key)
|
||||
return fallback
|
||||
}
|
||||
return configValue
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"net/http"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
|
@ -49,7 +48,7 @@ func (p *GPTPlugin) register() {
|
|||
Kind: bot.Message, IsCmd: true,
|
||||
Regex: regexp.MustCompile(`(?is)^gpt (?P<text>.*)`),
|
||||
HelpText: "chat completion",
|
||||
Handler: p.chatMessageForce,
|
||||
Handler: p.chatMessage,
|
||||
},
|
||||
{
|
||||
Kind: bot.Message, IsCmd: true,
|
||||
|
@ -63,6 +62,7 @@ func (p *GPTPlugin) register() {
|
|||
Handler: p.chatMessage,
|
||||
},
|
||||
}
|
||||
log.Debug().Msg("Registering GPT3 handlers")
|
||||
p.b.RegisterTable(p, p.h)
|
||||
}
|
||||
|
||||
|
@ -77,14 +77,6 @@ func (p *GPTPlugin) setPromptMessage(r bot.Request) bool {
|
|||
}
|
||||
|
||||
func (p *GPTPlugin) chatMessage(r bot.Request) bool {
|
||||
if slices.Contains(p.c.GetArray("gpt.silence", []string{}), r.Msg.Channel) {
|
||||
log.Debug().Msgf("%s silenced", r.Msg.Channel)
|
||||
return true
|
||||
}
|
||||
return p.chatMessageForce(r)
|
||||
}
|
||||
|
||||
func (p *GPTPlugin) chatMessageForce(r bot.Request) bool {
|
||||
resp, err := p.chatGPT(r.Values["text"])
|
||||
if err != nil {
|
||||
resp = fmt.Sprintf("Error: %s", err)
|
||||
|
|
Loading…
Reference in New Issue