Fixed selected model changes when entering manage models dialog

This commit is contained in:
jeffser 2024-08-04 22:42:49 -06:00
parent 7440fa5a37
commit 6e226c5a4f
2 changed files with 11 additions and 5 deletions

View File

@ -122,16 +122,16 @@
"sources": [ "sources": [
{ {
"type": "file", "type": "file",
"url": "https://github.com/ollama/ollama/releases/download/v0.3.0/ollama-linux-amd64", "url": "https://github.com/ollama/ollama/releases/download/v0.3.3/ollama-linux-amd64",
"sha256": "b8817c34882c7ac138565836ac1995a2c61261a79315a13a0aebbfe5435da855", "sha256": "2b2a4ee4c86fa5b09503e95616bd1b3ee95238b1b3bf12488b9c27c66b84061a",
"only-arches": [ "only-arches": [
"x86_64" "x86_64"
] ]
}, },
{ {
"type": "file", "type": "file",
"url": "https://github.com/ollama/ollama/releases/download/v0.3.0/ollama-linux-arm64", "url": "https://github.com/ollama/ollama/releases/download/v0.3.3/ollama-linux-arm64",
"sha256": "64be908749212052146f1008dd3867359c776ac1766e8d86291886f53d294d4d", "sha256": "28fddbea0c161bc539fd08a3dc78d51413cfe8da97386cb39420f4f30667e22c",
"only-arches": [ "only-arches": [
"aarch64" "aarch64"
] ]

View File

@ -257,6 +257,13 @@ class AlpacaWindow(Adw.ApplicationWindow):
def manage_models_button_activate(self, button=None): def manage_models_button_activate(self, button=None):
logger.debug(f"Managing models") logger.debug(f"Managing models")
self.update_list_local_models() self.update_list_local_models()
if len(self.chats["chats"][self.chats["selected_chat"]]["messages"].keys()) > 0:
last_model_used = self.chats["chats"][self.chats["selected_chat"]]["messages"][list(self.chats["chats"][self.chats["selected_chat"]]["messages"].keys())[-1]]["model"]
last_model_used = self.convert_model_name(last_model_used, 0)
for i in range(self.model_string_list.get_n_items()):
if self.model_string_list.get_string(i) == last_model_used:
self.model_drop_down.set_selected(i)
break
self.manage_models_dialog.present(self) self.manage_models_dialog.present(self)
@Gtk.Template.Callback() @Gtk.Template.Callback()
@ -392,7 +399,6 @@ class AlpacaWindow(Adw.ApplicationWindow):
overlay.add_overlay(progress_bar) overlay.add_overlay(progress_bar)
self.pulling_model_list_box.append(overlay) self.pulling_model_list_box.append(overlay)
self.navigation_view_manage_models.pop() self.navigation_view_manage_models.pop()
self.manage_models_dialog.present(self)
thread.start() thread.start()
@Gtk.Template.Callback() @Gtk.Template.Callback()