Remove /resetmatty, fix persona list formatting, bump to v0.1.13
This commit is contained in:
+17
-24
@@ -9,36 +9,30 @@ import (
|
||||
"github.com/mattermost/mattermost/server/public/plugin"
|
||||
)
|
||||
|
||||
const helpText = `### Matty -- AI Chat Agent
|
||||
const helpText = `### Matty -- forkless' annoying sidekick
|
||||
|
||||
**@mention the bot in any channel to start a conversation.**
|
||||
@mention the bot in any channel to start a conversation. The bot responds only when addressed and disengages naturally.
|
||||
|
||||
**Commands:**
|
||||
**Chat:**
|
||||
@matty <prompt> -- Chat with default model
|
||||
@matty model <name> <prompt> -- Use a specific model
|
||||
@matty model list -- List available models
|
||||
|
||||
- @matty <prompt> -- Chat with the default model
|
||||
- @matty model <name> <prompt> -- Use a specific model
|
||||
- @matty persona <name> -- Switch persona (e.g. "trump", "carlin", "sysadmin")
|
||||
- @matty new -- Reset conversation context
|
||||
- @matty model list -- List available models
|
||||
- @matty help -- Show this help
|
||||
- @matty stop -- End the current conversation
|
||||
**Personas:**
|
||||
@matty persona -- Show current persona
|
||||
@matty persona list -- List all personas
|
||||
@matty persona <name> -- Switch persona
|
||||
|
||||
You can also use /ai <prompt> as an alternative. /resetmatty clears memory.
|
||||
**Other:**
|
||||
@matty new -- Reset conversation context
|
||||
@matty stop -- End conversation
|
||||
@matty help -- Show this
|
||||
|
||||
The bot responds only when addressed and disengages naturally.
|
||||
Also works with /ai <prompt>. /ai new clears memory.
|
||||
`
|
||||
|
||||
// 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)
|
||||
@@ -162,16 +156,15 @@ func (p *Plugin) listPersonas() string {
|
||||
}
|
||||
sort.Strings(ids)
|
||||
var b strings.Builder
|
||||
b.WriteString("Available personas:\n")
|
||||
b.WriteString("Available personas:\n\n```\n")
|
||||
for _, id := range ids {
|
||||
desc := personaLibrary[id]
|
||||
// Truncate to ~60 chars for a compact preview.
|
||||
if len(desc) > 60 {
|
||||
desc = desc[:57] + "..."
|
||||
}
|
||||
b.WriteString(fmt.Sprintf(" %-12s %s\n", id, desc))
|
||||
}
|
||||
b.WriteString("Use /ai persona <name> to switch.")
|
||||
b.WriteString("```\nUse /ai persona <name> to switch.")
|
||||
return b.String()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user