From 35340d88863cb2a6a1b883bd3312abfef3a24c7a Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Thu, 21 Nov 2024 07:25:23 +0300 Subject: Fix: chat upsert --- session.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'session.go') diff --git a/session.go b/session.go index a6c0e8b..23d725d 100644 --- a/session.go +++ b/session.go @@ -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 } -- cgit v1.2.3