Remove /resetmatty, fix persona list formatting, bump to v0.1.13
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
# make clean — Remove build artifacts
|
||||
|
||||
PLUGIN_ID := com.forkless.mattermore
|
||||
PLUGIN_VERSION := 0.1.9
|
||||
PLUGIN_VERSION := 0.1.13
|
||||
DIST_DIR := dist
|
||||
SERVER_DIR := server
|
||||
BUNDLE_NAME := $(PLUGIN_ID)-$(PLUGIN_VERSION).tar.gz
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"id": "com.forkless.mattermore",
|
||||
"name": "Matty",
|
||||
"description": "AI chat agent powered by Ollama.",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.13",
|
||||
"min_server_version": "11.6.1",
|
||||
"server": {
|
||||
"executables": {
|
||||
|
||||
+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()
|
||||
}
|
||||
|
||||
|
||||
+2
-11
@@ -26,17 +26,7 @@ func (p *Plugin) OnActivate() error {
|
||||
return fmt.Errorf("register command: %w", err)
|
||||
}
|
||||
|
||||
// Register the /resetmatty command.
|
||||
if err := p.API.RegisterCommand(&model.Command{
|
||||
Trigger: "resetmatty",
|
||||
DisplayName: "Reset Matty",
|
||||
Description: "Clear conversation context and end active session.",
|
||||
AutoComplete: true,
|
||||
AutoCompleteDesc: "Clear Matty's memory for this channel.",
|
||||
AutoCompleteHint: "",
|
||||
}); err != nil {
|
||||
return fmt.Errorf("register reset command: %w", err)
|
||||
}
|
||||
|
||||
|
||||
// Ensure the bot account exists — create or re-use.
|
||||
var err error
|
||||
@@ -203,6 +193,7 @@ func (p *Plugin) MessageHasBeenPosted(c *plugin.Context, post *model.Post) {
|
||||
// Prepend the persona system prompt to set the bot's character.
|
||||
// Priority: KV override > CustomPersona config > Persona dropdown config
|
||||
persona := p.GetPersonaOverride(post.UserId, post.ChannelId)
|
||||
persona = resolvePersona(persona)
|
||||
if persona == "" {
|
||||
persona = cfg.CustomPersona
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user