summaryrefslogtreecommitdiff
path: root/session.go
diff options
context:
space:
mode:
Diffstat (limited to 'session.go')
-rw-r--r--session.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/session.go b/session.go
index 88b370c..c3d826f 100644
--- a/session.go
+++ b/session.go
@@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
+ "os"
"os/exec"
"strings"
"time"
@@ -25,6 +26,14 @@ func historyToSJSON(msgs []models.RoleMsg) (string, error) {
return string(data), nil
}
+func exportChat() error {
+ data, err := json.MarshalIndent(chatBody.Messages, "", " ")
+ if err != nil {
+ return err
+ }
+ return os.WriteFile(activeChatName+".json", data, 0666)
+}
+
func updateStorageChat(name string, msgs []models.RoleMsg) error {
var err error
chat, ok := chatMap[name]