Fix unknown persona detection, bump to v0.1.16
This commit is contained in:
@@ -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