diff options
| author | Grail Finder <wohilas@gmail.com> | 2026-01-21 21:01:01 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2026-01-21 21:01:01 +0300 |
| commit | a28e8ef9e250ace5c9624393da308c189c0839f6 (patch) | |
| tree | f2adfa647126c3c7e0d82decbdb888360729a8df /helpfuncs.go | |
| parent | 4e597e944eacbeb5269dfdf586dd4a2163762a17 (diff) | |
Enha: charlist in cards
Diffstat (limited to 'helpfuncs.go')
| -rw-r--r-- | helpfuncs.go | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/helpfuncs.go b/helpfuncs.go index ccb5858..f74cd13 100644 --- a/helpfuncs.go +++ b/helpfuncs.go @@ -164,7 +164,7 @@ func setLogLevel(sl string) { } func listRolesWithUser() []string { - roles := chatBody.ListRoles() + roles := listChatRoles() // Remove user role if it exists in the list (to avoid duplicates and ensure it's at position 0) filteredRoles := make([]string, 0, len(roles)) for _, role := range roles { @@ -250,3 +250,26 @@ func randString(n int) string { } return string(b) } + +// set of roles within card definition and mention in chat history +func listChatRoles() []string { + currentChat, ok := chatMap[activeChatName] + cbc := chatBody.ListRoles() + if !ok { + return cbc + } + currentCard, ok := sysMap[currentChat.Agent] + if !ok { + // log error + logger.Warn("failed to find current card in sysMap", "agent", currentChat.Agent, "sysMap", sysMap) + return cbc + } + charset := []string{} + for _, name := range currentCard.Characters { + if !strInSlice(name, cbc) { + charset = append(charset, name) + } + } + charset = append(charset, cbc...) + return charset +} |
