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