Fix: chat upsert

This commit is contained in:
Grail Finder
2024-11-21 07:25:23 +03:00
parent 5ccad20bd6
commit 35340d8886
3 changed files with 9 additions and 4 deletions

View File

@@ -90,6 +90,12 @@ func loadOldChatOrGetNew() []models.MessagesStory {
chatMap[newChat.Name] = newChat
return defaultStarter
}
if chat.Name == "" {
logger.Warn("empty chat name", "id", chat.ID)
chat.Name = fmt.Sprintf("%d_%v", chat.ID, chat.CreatedAt.Unix())
}
chatMap[chat.Name] = chat
activeChatName = chat.Name
return history
}