From b6c45fc3463f62ff8f2b7f4bd0eac02c9ddcc8d0 Mon Sep 17 00:00:00 2001 From: jeffser Date: Sun, 26 May 2024 00:42:23 -0600 Subject: [PATCH] Fixed issue: Can't load chats --- src/window.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/window.py b/src/window.py index 578b8a4..9f03920 100644 --- a/src/window.py +++ b/src/window.py @@ -603,6 +603,7 @@ class AlpacaWindow(Adw.ApplicationWindow): self.available_model_list_box.append(model) def save_history(self): + print("Saving...") with open(os.path.join(self.config_dir, "chats.json"), "w+") as f: json.dump(self.chats, f, indent=4) @@ -618,14 +619,13 @@ class AlpacaWindow(Adw.ApplicationWindow): def load_history(self): if os.path.exists(os.path.join(self.config_dir, "chats.json")): - self.clear_chat() try: with open(os.path.join(self.config_dir, "chats.json"), "r") as f: self.chats = json.load(f) if "selected_chat" not in self.chats or self.chats["selected_chat"] not in self.chats["chats"]: self.chats["selected_chat"] = list(self.chats["chats"].keys())[0] - if len(list(self.chats["chats"].keys())) == 0: self.chats["chats"]["New Chat"] = {"messages": []} + if len(list(self.chats["chats"].keys())) == 0: self.chats["chats"][_("New Chat")] = {"messages": []} except Exception as e: - self.chats = {"chats": {"New Chat": {"messages": []}}, "selected_chat": "New Chat"} + self.chats = {"chats": {_("New Chat"): {"messages": []}}, "selected_chat": _("New Chat")} self.load_history_into_chat() def load_image(self, file_dialog, result):