summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bot.go12
-rw-r--r--helpfuncs.go2
-rw-r--r--tui.go3
3 files changed, 5 insertions, 12 deletions
diff --git a/bot.go b/bot.go
index 13d488a..a28097f 100644
--- a/bot.go
+++ b/bot.go
@@ -19,6 +19,7 @@ import (
"os"
"path"
"regexp"
+ "slices"
"strconv"
"strings"
"sync"
@@ -154,15 +155,8 @@ func filterMessagesForCharacter(messages []models.RoleMsg, character string) []m
filtered = append(filtered, msg)
continue
}
- // Check if character is in KnownTo list
- found := false
- for _, k := range msg.KnownTo {
- if k == character {
- found = true
- break
- }
- }
- if found {
+ if slices.Contains(msg.KnownTo, character) {
+ // Check if character is in KnownTo lis
filtered = append(filtered, msg)
}
}
diff --git a/helpfuncs.go b/helpfuncs.go
index 49069a2..7033f04 100644
--- a/helpfuncs.go
+++ b/helpfuncs.go
@@ -7,6 +7,7 @@ import (
"image"
"os"
"path"
+ "slices"
"strings"
"unicode"
@@ -198,6 +199,7 @@ func listRolesWithUser() []string {
}
// Prepend user role to the beginning of the list
result := append([]string{cfg.UserRole}, filteredRoles...)
+ slices.Sort(result)
return result
}
diff --git a/tui.go b/tui.go
index e164423..8b1c520 100644
--- a/tui.go
+++ b/tui.go
@@ -1187,7 +1187,6 @@ func init() {
persona = cfg.WriteNextMsgAs
}
roles := listRolesWithUser()
- logger.Info("list roles", "roles", roles)
for i, role := range roles {
if strings.EqualFold(role, persona) {
if i == len(roles)-1 {
@@ -1197,7 +1196,6 @@ func init() {
}
cfg.WriteNextMsgAs = roles[i+1] // get next role
persona = cfg.WriteNextMsgAs
- // logger.Info("picked role", "roles", roles, "index", i+1)
break
}
}
@@ -1228,7 +1226,6 @@ func init() {
break
}
cfg.WriteNextMsgAsCompletionAgent = roles[i+1] // get next role
- // logger.Info("picked role", "roles", roles, "index", i+1)
break
}
}