Fix: do not skip system msgs
This commit is contained in:
5
bot.go
5
bot.go
@@ -95,7 +95,6 @@ func parseKnownToTag(content string) (string, []string) {
|
|||||||
}
|
}
|
||||||
// Remove the entire matched tag from content
|
// Remove the entire matched tag from content
|
||||||
cleaned = strings.Replace(cleaned, match[0], "", 1)
|
cleaned = strings.Replace(cleaned, match[0], "", 1)
|
||||||
|
|
||||||
list := strings.TrimSpace(match[1])
|
list := strings.TrimSpace(match[1])
|
||||||
if list == "" {
|
if list == "" {
|
||||||
continue
|
continue
|
||||||
@@ -122,6 +121,7 @@ func processMessageTag(msg models.RoleMsg) models.RoleMsg {
|
|||||||
// If KnownTo already set, assume tag already processed (content cleaned).
|
// If KnownTo already set, assume tag already processed (content cleaned).
|
||||||
// However, we still check for new tags (maybe added later).
|
// However, we still check for new tags (maybe added later).
|
||||||
cleaned, knownTo := parseKnownToTag(msg.Content)
|
cleaned, knownTo := parseKnownToTag(msg.Content)
|
||||||
|
logger.Info("processing tags", "msg", msg.Content, "known_to", knownTo)
|
||||||
if cleaned != msg.Content {
|
if cleaned != msg.Content {
|
||||||
msg.Content = cleaned
|
msg.Content = cleaned
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,8 @@ func filterMessagesForCharacter(messages []models.RoleMsg, character string) []m
|
|||||||
for i, msg := range messages {
|
for i, msg := range messages {
|
||||||
logger.Info("filtering messages", "character", character, "index", i, "known_to", msg.KnownTo)
|
logger.Info("filtering messages", "character", character, "index", i, "known_to", msg.KnownTo)
|
||||||
// If KnownTo is nil or empty, message is visible to all
|
// If KnownTo is nil or empty, message is visible to all
|
||||||
if len(msg.KnownTo) == 0 {
|
// system msg cannot be filtered
|
||||||
|
if len(msg.KnownTo) == 0 || msg.Role == "system" {
|
||||||
filtered = append(filtered, msg)
|
filtered = append(filtered, msg)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user