This commit is contained in:
Jeff Carr 2025-08-22 02:26:40 -05:00
parent 3b6b85200d
commit 185677e464
1 changed files with 7 additions and 8 deletions

View File

@ -68,11 +68,11 @@ func (all *Chats) AddFile(filename string) error {
return err return err
} }
// Iterate through the top-level messages from the source file. // New logic to handle both flat and nested formats
for _, chatGroup := range logData.GetChats() { for _, chatOrGroup := range logData.GetChats() {
if len(chatGroup.GetEntries()) > 0 { if len(chatOrGroup.GetEntries()) > 0 {
// NEW FORMAT: This is a group, process its entries. // This is a new-style Chat group with entries
for _, entry := range chatGroup.GetEntries() { for _, entry := range chatOrGroup.GetEntries() {
// Convert the ChatEntry into a new Chat object for the flat list. // Convert the ChatEntry into a new Chat object for the flat list.
newChat := convertEntryToChat(entry, filename) newChat := convertEntryToChat(entry, filename)
if newChat != nil { if newChat != nil {
@ -81,9 +81,9 @@ func (all *Chats) AddFile(filename string) error {
} }
} }
} else { } else {
// OLD FORMAT: This is a single, flat Chat message. // This is an old-style flat Chat entry.
// We still process it to handle its external content file correctly. // We still process it to handle its external content file correctly.
newChat := convertChatToChat(chatGroup, filename) newChat := convertChatToChat(chatOrGroup, filename)
if newChat != nil { if newChat != nil {
newChat.VerifyUuid() newChat.VerifyUuid()
all.AppendByUuid(newChat) all.AppendByUuid(newChat)
@ -150,7 +150,6 @@ func convertEntryToChat(entry *ChatEntry, filename string) *Chat {
return newChat return newChat
} }
func (chats *Chats) VerifyUuids() bool { func (chats *Chats) VerifyUuids() bool {
var changed bool var changed bool