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
|
# make clean — Remove build artifacts
|
||||||
|
|
||||||
PLUGIN_ID := com.forkless.mattermore
|
PLUGIN_ID := com.forkless.mattermore
|
||||||
PLUGIN_VERSION := 0.1.9
|
PLUGIN_VERSION := 0.1.13
|
||||||
DIST_DIR := dist
|
DIST_DIR := dist
|
||||||
SERVER_DIR := server
|
SERVER_DIR := server
|
||||||
BUNDLE_NAME := $(PLUGIN_ID)-$(PLUGIN_VERSION).tar.gz
|
BUNDLE_NAME := $(PLUGIN_ID)-$(PLUGIN_VERSION).tar.gz
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"id": "com.forkless.mattermore",
|
"id": "com.forkless.mattermore",
|
||||||
"name": "Matty",
|
"name": "Matty",
|
||||||
"description": "AI chat agent powered by Ollama.",
|
"description": "AI chat agent powered by Ollama.",
|
||||||
"version": "0.1.9",
|
"version": "0.1.13",
|
||||||
"min_server_version": "11.6.1",
|
"min_server_version": "11.6.1",
|
||||||
"server": {
|
"server": {
|
||||||
"executables": {
|
"executables": {
|
||||||
|
|||||||
+17
-24
@@ -9,36 +9,30 @@ import (
|
|||||||
"github.com/mattermost/mattermost/server/public/plugin"
|
"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
|
**Personas:**
|
||||||
- @matty model <name> <prompt> -- Use a specific model
|
@matty persona -- Show current persona
|
||||||
- @matty persona <name> -- Switch persona (e.g. "trump", "carlin", "sysadmin")
|
@matty persona list -- List all personas
|
||||||
- @matty new -- Reset conversation context
|
@matty persona <name> -- Switch persona
|
||||||
- @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. /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).
|
// ExecuteCommand handles slash commands (/ai, /resetmatterless).
|
||||||
func (p *Plugin) ExecuteCommand(_ *plugin.Context, args *model.CommandArgs) (*model.CommandResponse, *model.AppError) {
|
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.
|
// /ai — dispatch subcommands.
|
||||||
trigger := strings.TrimSpace(strings.TrimPrefix(strings.TrimSpace(args.Command), "/ai"))
|
trigger := strings.TrimSpace(strings.TrimPrefix(strings.TrimSpace(args.Command), "/ai"))
|
||||||
parts := parseArgs(trigger)
|
parts := parseArgs(trigger)
|
||||||
@@ -162,16 +156,15 @@ func (p *Plugin) listPersonas() string {
|
|||||||
}
|
}
|
||||||
sort.Strings(ids)
|
sort.Strings(ids)
|
||||||
var b strings.Builder
|
var b strings.Builder
|
||||||
b.WriteString("Available personas:\n")
|
b.WriteString("Available personas:\n\n```\n")
|
||||||
for _, id := range ids {
|
for _, id := range ids {
|
||||||
desc := personaLibrary[id]
|
desc := personaLibrary[id]
|
||||||
// Truncate to ~60 chars for a compact preview.
|
|
||||||
if len(desc) > 60 {
|
if len(desc) > 60 {
|
||||||
desc = desc[:57] + "..."
|
desc = desc[:57] + "..."
|
||||||
}
|
}
|
||||||
b.WriteString(fmt.Sprintf(" %-12s %s\n", id, desc))
|
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()
|
return b.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-11
@@ -26,17 +26,7 @@ func (p *Plugin) OnActivate() error {
|
|||||||
return fmt.Errorf("register command: %w", err)
|
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.
|
// Ensure the bot account exists — create or re-use.
|
||||||
var err error
|
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.
|
// Prepend the persona system prompt to set the bot's character.
|
||||||
// Priority: KV override > CustomPersona config > Persona dropdown config
|
// Priority: KV override > CustomPersona config > Persona dropdown config
|
||||||
persona := p.GetPersonaOverride(post.UserId, post.ChannelId)
|
persona := p.GetPersonaOverride(post.UserId, post.ChannelId)
|
||||||
|
persona = resolvePersona(persona)
|
||||||
if persona == "" {
|
if persona == "" {
|
||||||
persona = cfg.CustomPersona
|
persona = cfg.CustomPersona
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user