From 68738f847b3dff439ee442d3a9e8cea057762c84 Mon Sep 17 00:00:00 2001 From: Chris Sexton <3216719+chrissexton@users.noreply.github.com> Date: Tue, 7 Feb 2023 10:21:43 -0500 Subject: [PATCH] gpt3: moderation toggle --- plugins/gpt3/gpt3.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/gpt3/gpt3.go b/plugins/gpt3/gpt3.go index 7f350e0..c00048e 100644 --- a/plugins/gpt3/gpt3.go +++ b/plugins/gpt3/gpt3.go @@ -56,7 +56,7 @@ func (p *GPT3Plugin) message(r bot.Request) bool { func (p *GPT3Plugin) mkRequest(stem string) string { log.Debug().Msgf("Got GPT3 request: %s", stem) if err := p.checkStem(stem); err != nil { - return "GPT3 Moderation " + err.Error() + return "GPT3 moderation " + err.Error() } postStruct := gpt3Request{ Prompt: stem, @@ -104,6 +104,9 @@ func (p *GPT3Plugin) mkRequest(stem string) string { } func (p *GPT3Plugin) checkStem(stem string) error { + if !p.c.GetBool("gpt3.moderation", true) { + return nil + } postBody, _ := json.Marshal(gpt3ModRequest{Input: stem}) client := &http.Client{} req, err := http.NewRequest("POST", gpt3ModURL, bytes.NewBuffer(postBody))