From 95cbc928e17fd83308a6e4c11160e01d610bf4b5 Mon Sep 17 00:00:00 2001 From: Fork Less Date: Tue, 16 Jun 2026 21:30:34 +0200 Subject: [PATCH] Remove /resetmatty, fix persona list formatting, bump to v0.1.13 --- Makefile | 2 +- plugin.json | 2 +- server/command.go | 41 +++++++++++++++++------------------------ server/hooks.go | 13 ++----------- 4 files changed, 21 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 277e056..d537485 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/plugin.json b/plugin.json index eba4b17..e6a8b52 100644 --- a/plugin.json +++ b/plugin.json @@ -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": { diff --git a/server/command.go b/server/command.go index 77dc7af..ad3098d 100644 --- a/server/command.go +++ b/server/command.go @@ -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 -- Chat with default model + @matty model -- Use a specific model + @matty model list -- List available models -- @matty -- Chat with the default model -- @matty model -- Use a specific model -- @matty persona -- 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 -- Switch persona -You can also use /ai 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 . /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 to switch.") + b.WriteString("```\nUse /ai persona to switch.") return b.String() } diff --git a/server/hooks.go b/server/hooks.go index f751e03..e8c3af1 100644 --- a/server/hooks.go +++ b/server/hooks.go @@ -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 }