Update welcome screen when a model is pulled / created / deleted

This commit is contained in:
jeffser 2024-09-02 13:36:17 -06:00
parent 5801d43af9
commit 687b99f9ab
2 changed files with 10 additions and 3 deletions

View File

@ -262,6 +262,12 @@ class chat_list(Gtk.ListBox):
self.connect("row-selected", lambda listbox, row: self.chat_changed(row))
self.tab_list = []
def update_welcome_screens(self, show_prompts:bool):
print('SHOW_PROMPTS: ', show_prompts)
for tab in self.tab_list:
if tab.chat_window.welcome_screen:
tab.chat_window.show_welcome_screen(show_prompts)
def get_tab_by_name(self, chat_name:str) -> chat_tab:
for tab in self.tab_list:
if tab.chat_window.get_name() == chat_name:

View File

@ -436,9 +436,10 @@ class model_manager_container(Gtk.Box):
if response.status_code == 200:
self.local_list.remove_model(model_name)
if len(list(self.local_list)) == 0:
self.local_list.set_visible(False)
self.model_selector.remove_model(model_name)
if len(self.get_model_list()) == 0:
self.local_list.set_visible(False)
window.chat_list_box.update_welcome_screens(False)
window.show_toast(_("Model deleted successfully"), window.manage_models_overlay)
else:
window.manage_models_dialog.close()
@ -526,7 +527,7 @@ class model_manager_container(Gtk.Box):
GLib.idle_add(window.connection_error)
self.pulling_list.remove(model)
GLib.idle_add(window.chat_list_box.update_welcome_screens, len(self.get_model_list()) > 0)
if len(list(self.pulling_list)) == 0:
GLib.idle_add(self.pulling_list.set_visible, False)