Add EngagementEngine, persona system, dropdowns, penalties, /resetmatty, debug logging

This commit is contained in:
2026-06-16 19:45:50 +02:00
parent 83da1698c0
commit 31a81fbfaa
10 changed files with 411 additions and 129 deletions
+21 -10
View File
@@ -8,26 +8,36 @@ import (
"github.com/mattermost/mattermost/server/public/plugin"
)
const helpText = `### Mattermore -- AI Chat Agent
const helpText = `### Matty -- AI Chat Agent
**@mention the bot in any channel to start a conversation.**
**Commands:**
- @mattermore <prompt> -- Chat with the default model
- @mattermore model <name> <prompt> -- Use a specific model
- @mattermore new -- Reset conversation context
- @mattermore model list -- List available models
- @mattermore help -- Show this help
- @mattermore stop -- End the current conversation
- @matty <prompt> -- Chat with the default model
- @matty model <name> <prompt> -- Use a specific model
- @matty new -- Reset conversation context
- @matty model list -- List available models
- @matty help -- Show this help
- @matty stop -- End the current conversation
You can also use /ai <prompt> as an alternative.
You can also use /ai <prompt> as an alternative. /resetmatty clears memory.
The bot responds only when addressed and disengages naturally.
`
// ExecuteCommand handles the /ai slash command.
// ExecuteCommand handles slash commands (/ai, /resetmatterless).
func (p *Plugin) ExecuteCommand(_ *plugin.Context, args *model.CommandArgs) (*model.CommandResponse, *model.AppError) {
// /resetmatty — clear context and end session.
if args.Command == "/resetmatty" {
if err := p.conversationStore.Reset(args.UserId, args.ChannelId); err != nil {
return p.response("Failed to reset conversation."), nil
}
p.engagementEngine.Sleep(args.UserId, args.ChannelId)
return p.response("Matty's memory wiped. @matty to start again."), nil
}
// /ai — dispatch subcommands.
trigger := strings.TrimSpace(strings.TrimPrefix(strings.TrimSpace(args.Command), "/ai"))
parts := parseArgs(trigger)
@@ -39,7 +49,8 @@ func (p *Plugin) ExecuteCommand(_ *plugin.Context, args *model.CommandArgs) (*mo
if err := p.conversationStore.Reset(args.UserId, args.ChannelId); err != nil {
return p.response("Failed to reset conversation."), nil
}
return p.response("Conversation reset. Start fresh with @mattermore <prompt>"), nil
p.engagementEngine.Sleep(args.UserId, args.ChannelId)
return p.response("Conversation reset. @matty to start again."), nil
case parts[0] == "model" && len(parts) >= 2 && parts[1] == "list":
return p.handleModelList(args)