diff options
author | Grail Finder <wohilas@gmail.com> | 2024-12-02 19:58:03 +0300 |
---|---|---|
committer | Grail Finder <wohilas@gmail.com> | 2024-12-02 19:58:03 +0300 |
commit | a5ab816c9434022159548ac0d1872160b3c8908d (patch) | |
tree | a4e68c334f2a514f02afd65a1bb70eff415fb8cd /session.go | |
parent | 8d3997baff25f28c23441699be7692f853cf1f0f (diff) |
Feat: add character card support
Diffstat (limited to 'session.go')
-rw-r--r-- | session.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -14,7 +14,7 @@ var ( chatMap = make(map[string]*models.Chat) ) -func historyToSJSON(msgs []models.MessagesStory) (string, error) { +func historyToSJSON(msgs []models.RoleMsg) (string, error) { data, err := json.Marshal(msgs) if err != nil { return "", err @@ -25,7 +25,7 @@ func historyToSJSON(msgs []models.MessagesStory) (string, error) { return string(data), nil } -func updateStorageChat(name string, msgs []models.MessagesStory) error { +func updateStorageChat(name string, msgs []models.RoleMsg) error { var err error chat, ok := chatMap[name] if !ok { @@ -59,7 +59,7 @@ func loadHistoryChats() ([]string, error) { return resp, nil } -func loadHistoryChat(chatName string) ([]models.MessagesStory, error) { +func loadHistoryChat(chatName string) ([]models.RoleMsg, error) { chat, ok := chatMap[chatName] if !ok { err := errors.New("failed to read chat") @@ -70,7 +70,7 @@ func loadHistoryChat(chatName string) ([]models.MessagesStory, error) { return chat.ToHistory() } -func loadOldChatOrGetNew() []models.MessagesStory { +func loadOldChatOrGetNew() []models.RoleMsg { newChat := &models.Chat{ ID: 0, CreatedAt: time.Now(), |