From 5ccad20bd680dc443b30f0decc8fca13427dc70d Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Wed, 20 Nov 2024 20:47:49 +0300 Subject: Feat: add memory [wip] --- session.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'session.go') diff --git a/session.go b/session.go index 59baab4..a6c0e8b 100644 --- a/session.go +++ b/session.go @@ -69,14 +69,14 @@ func loadHistoryChat(chatName string) ([]models.MessagesStory, error) { } func loadOldChatOrGetNew() []models.MessagesStory { - // find last chat - chat, err := store.GetLastChat() newChat := &models.Chat{ ID: 0, CreatedAt: time.Now(), UpdatedAt: time.Now(), } - newChat.Name = fmt.Sprintf("%d_%v", chat.ID, chat.CreatedAt.Unix()) + newChat.Name = fmt.Sprintf("%d_%v", newChat.ID, newChat.CreatedAt.Unix()) + // find last chat + chat, err := store.GetLastChat() if err != nil { logger.Warn("failed to load history chat", "error", err) activeChatName = newChat.Name -- cgit v1.2.3