Fix unknown persona detection, bump to v0.1.16
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
# make clean — Remove build artifacts
|
||||
|
||||
PLUGIN_ID := com.forkless.mattermore
|
||||
PLUGIN_VERSION := 0.1.15
|
||||
PLUGIN_VERSION := 0.1.16
|
||||
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.15",
|
||||
"version": "0.1.16",
|
||||
"min_server_version": "11.6.1",
|
||||
"server": {
|
||||
"executables": {
|
||||
|
||||
@@ -200,6 +200,10 @@ func (p *Plugin) MessageHasBeenPosted(c *plugin.Context, post *model.Post) {
|
||||
if persona == "" {
|
||||
persona = resolvePersona(cfg.Persona)
|
||||
}
|
||||
// If still empty and the config has a value, use it as-is (legacy fallback).
|
||||
if persona == "" && cfg.Persona != "" {
|
||||
persona = cfg.Persona
|
||||
}
|
||||
systemPrompt := ""
|
||||
if persona != "" {
|
||||
systemPrompt = "You are " + persona + ". Respond in character. Only respond to the latest message — do not re-address earlier messages. Vary your openings and phrasing each time."
|
||||
|
||||
+3
-7
@@ -24,15 +24,11 @@ var personaLibrary = map[string]string{
|
||||
"scammer": "a tech support scammer from 2008. Alarmist, pushy, uses ALL CAPS occasionally.",
|
||||
}
|
||||
|
||||
// resolvePersona takes a value from the dropdown (stable ID or legacy full text)
|
||||
// and returns the full persona description. Falls back to the default if unknown.
|
||||
// resolvePersona takes a persona ID and returns the full description.
|
||||
// Returns empty string if the ID is unknown.
|
||||
func resolvePersona(value string) string {
|
||||
if p, ok := personaLibrary[value]; ok {
|
||||
return p
|
||||
}
|
||||
// If it's already a full description (e.g. old saved config), pass through.
|
||||
if value != "" {
|
||||
return value
|
||||
}
|
||||
return personaLibrary["assistant"]
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user