Fixed clear chat
This commit is contained in:
parent
80dcae194b
commit
51d2326dee
@ -81,7 +81,7 @@ class chat(Gtk.ScrolledWindow):
|
|||||||
def clear_chat(self):
|
def clear_chat(self):
|
||||||
if self.busy:
|
if self.busy:
|
||||||
self.stop_message()
|
self.stop_message()
|
||||||
self.message = {}
|
self.messages = {}
|
||||||
self.stop_message()
|
self.stop_message()
|
||||||
for widget in list(self.container):
|
for widget in list(self.container):
|
||||||
self.container.remove(widget)
|
self.container.remove(widget)
|
||||||
|
@ -14,10 +14,11 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
def clear_chat_response(self, dialog, task):
|
def clear_chat_response(self, dialog, task):
|
||||||
if dialog.choose_finish(task) == "clear":
|
if dialog.choose_finish(task) == "clear":
|
||||||
self.chat_list_box.get_current_chat().clear_chat()
|
self.chat_list_box.get_current_chat().show_welcome_screen(len(self.model_manager.get_model_list()) > 0)
|
||||||
|
self.save_history(self.chat_list_box.get_current_chat())
|
||||||
|
|
||||||
def clear_chat(self):
|
def clear_chat(self):
|
||||||
if self.bot_message is not None:
|
if self.chat_list_box.get_current_chat().busy:
|
||||||
self.show_toast(_("Chat cannot be cleared while receiving a message"), self.main_overlay)
|
self.show_toast(_("Chat cannot be cleared while receiving a message"), self.main_overlay)
|
||||||
return
|
return
|
||||||
dialog = Adw.AlertDialog(
|
dialog = Adw.AlertDialog(
|
||||||
|
@ -562,7 +562,7 @@ Generate a title following these rules:
|
|||||||
|
|
||||||
|
|
||||||
def save_history(self, chat:chat_widget.chat=None):
|
def save_history(self, chat:chat_widget.chat=None):
|
||||||
logger.debug("Saving history")
|
logger.info("Saving history")
|
||||||
history = None
|
history = None
|
||||||
if chat and os.path.exists(os.path.join(data_dir, "chats", "chats.json")):
|
if chat and os.path.exists(os.path.join(data_dir, "chats", "chats.json")):
|
||||||
history = {'chats': {chat.get_name(): {'messages': chat.messages_to_dict()}}}
|
history = {'chats': {chat.get_name(): {'messages': chat.messages_to_dict()}}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user