diff options
author | Grail Finder <wohilas@gmail.com> | 2024-11-21 18:15:01 +0300 |
---|---|---|
committer | Grail Finder <wohilas@gmail.com> | 2024-11-21 18:15:01 +0300 |
commit | c35af037203ac5c39a4f704d5343bc2b5cc56a0c (patch) | |
tree | 0f392fc7788e3b2632ceeabe3b85af771c74fd2d /main.go | |
parent | 35340d88863cb2a6a1b883bd3312abfef3a24c7a (diff) |
Feat: add tools to tool map
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -1,8 +1,9 @@ package main import ( + "elefant/models" + "encoding/json" "fmt" - "path" "strconv" "time" "unicode" @@ -73,8 +74,19 @@ func main() { case "new": // set chat body chatBody.Messages = defaultStarter + // TODO: use predefined var since it is the same each time + msgsBytes, err := json.Marshal(chatBody.Messages) + if err != nil { + logger.Error(err.Error()) + } textView.SetText(chatToText(showSystemMsgs)) - activeChatName = path.Join(historyDir, fmt.Sprintf("%d_chat.json", time.Now().Unix())) + newChat := &models.Chat{ + Name: fmt.Sprintf("%v_%v", "new", time.Now().Unix()), + Msgs: string(msgsBytes), + } + // activeChatName = path.Join(historyDir, fmt.Sprintf("%d_chat.json", time.Now().Unix())) + activeChatName = newChat.Name + chatMap[newChat.Name] = newChat pages.RemovePage("history") return // set text @@ -141,7 +153,6 @@ func main() { editArea.SetText(m.Content, true) } if !editMode && event.Key() == tcell.KeyEnter { - // TODO: add notification that text was copied copyToClipboard(m.Content) notification := fmt.Sprintf("msg '%s' was copied to the clipboard", m.Content[:30]) notifyUser("copied", notification) |