mirror of https://github.com/velour/catbase.git
llm: option to clear chat history
This commit is contained in:
parent
aec464c1bf
commit
2697e6a259
|
@ -57,9 +57,9 @@ func (p *LLMPlugin) register() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Kind: bot.Message, IsCmd: true,
|
Kind: bot.Message, IsCmd: true,
|
||||||
Regex: regexp.MustCompile(`(?is)^got (?P<text>.*)`),
|
Regex: regexp.MustCompile(`(?is)^llm-puke$`),
|
||||||
HelpText: "chat completion",
|
HelpText: "clear chat history",
|
||||||
Handler: p.chatMessage,
|
Handler: p.puke,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
p.b.RegisterTable(p, p.h)
|
p.b.RegisterTable(p, p.h)
|
||||||
|
@ -109,3 +109,10 @@ func (p *LLMPlugin) gptMessage(r bot.Request) bool {
|
||||||
p.b.Send(r.Conn, bot.Message, r.Msg.Channel, resp)
|
p.b.Send(r.Conn, bot.Message, r.Msg.Channel, resp)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *LLMPlugin) puke(r bot.Request) bool {
|
||||||
|
resp := fmt.Sprintf("I just forgot %d lines of chat history.", len(p.chatHistory))
|
||||||
|
p.chatHistory = []chatEntry{}
|
||||||
|
p.b.Send(r.Conn, bot.Message, r.Msg.Channel, resp)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue