UI Tweaks to manage models

This commit is contained in:
jeffser 2024-06-28 14:40:32 -06:00
parent 5bf77d6b97
commit 6a825f534f
2 changed files with 19 additions and 29 deletions

View File

@ -877,14 +877,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
subtitle = tag_data[1], subtitle = tag_data[1],
name = f"{model_name}:{tag_data[0]}" name = f"{model_name}:{tag_data[0]}"
) )
pull_button = Gtk.Button( tag_row.add_suffix(Gtk.Image.new_from_icon_name("folder-download-symbolic"))
icon_name = "folder-download-symbolic",
vexpand = False,
valign = 3,
tooltip_text = _("Pull '{} ({})'").format(model_name.capitalize(), tag_data[0])
)
pull_button.connect("clicked", lambda button, model_name=f"{model_name}:{tag_data[0]}" : self.confirm_pull_model(model_name))
#tag_row.add_suffix(pull_button)
self.model_tag_list_box.append(tag_row) self.model_tag_list_box.append(tag_row)
def update_list_available_models(self): def update_list_available_models(self):
@ -902,16 +895,9 @@ class AlpacaWindow(Adw.ApplicationWindow):
valign = 3, valign = 3,
tooltip_text = model_info["url"] tooltip_text = model_info["url"]
) )
pull_button = Gtk.Button(
icon_name = "step-over-symbolic",
vexpand = False,
valign = 3,
tooltip_text = _("Pull '{}'").format(name.capitalize())
)
link_button.connect("clicked", lambda button=link_button, link=model_info["url"]: os.system(f'xdg-open "{link}"')) link_button.connect("clicked", lambda button=link_button, link=model_info["url"]: os.system(f'xdg-open "{link}"'))
pull_button.connect("clicked", lambda button=pull_button, model_name=name: self.list_available_model_tags(model_name))
model.add_suffix(link_button) model.add_suffix(link_button)
#model.add_suffix(pull_button) model.add_suffix(Gtk.Image.new_from_icon_name("go-next"))
self.available_model_list_box.append(model) self.available_model_list_box.append(model)
def save_history(self): def save_history(self):
@ -934,8 +920,12 @@ class AlpacaWindow(Adw.ApplicationWindow):
try: try:
with open(os.path.join(self.data_dir, "chats", "chats.json"), "r") as f: with open(os.path.join(self.data_dir, "chats", "chats.json"), "r") as f:
self.chats = json.load(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": {}}
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 "order" not in self.chats:
self.chats["order"] = []
for chat_name in self.chats["chats"].keys():
self.chats["order"].append(chat_name)
except Exception as e: 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() self.load_history_into_chat()

View File

@ -289,17 +289,17 @@
<property name="icon-name">preferences-system-symbolic</property> <property name="icon-name">preferences-system-symbolic</property>
<child> <child>
<object class="AdwPreferencesGroup"> <object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Remote Connection</property> <!--<property name="title" translatable="yes">Remote Connection</property>
<property name="description" translatable="yes">Manage a remote connection to Ollama</property> <property name="description" translatable="yes">Manage a remote connection to Ollama</property>-->
<child> <child>
<object class="AdwSwitchRow" id="remote_connection_switch"> <object class="AdwSwitchRow" id="remote_connection_switch">
<property name="title" translatable="yes">Use remote connection</property> <property name="title" translatable="yes">Use Remote Connection to Ollama</property>
</object> </object>
</child> </child>
<child> <child>
<object class="AdwEntryRow" id="remote_connection_entry"> <object class="AdwEntryRow" id="remote_connection_entry">
<signal name="apply" handler="change_remote_url"/> <signal name="apply" handler="change_remote_url"/>
<property name="title" translatable="yes">URL of remote instance</property> <property name="title" translatable="yes">URL of Remote Instance</property>
<property name="show-apply-button">true</property> <property name="show-apply-button">true</property>
</object> </object>
</child> </child>
@ -307,11 +307,11 @@
</child> </child>
<child> <child>
<object class="AdwPreferencesGroup"> <object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Behavior</property> <!--<property name="title" translatable="yes">Behavior</property>
<property name="description" translatable="yes">Manage Alpaca's Behavior</property> <property name="description" translatable="yes">Manage Alpaca's Behavior</property>-->
<child> <child>
<object class="AdwSwitchRow" id="background_switch"> <object class="AdwSwitchRow" id="background_switch">
<property name="title" translatable="yes">Run in background</property> <property name="title" translatable="yes">Run In Background</property>
</object> </object>
</child> </child>
</object> </object>
@ -324,8 +324,8 @@
<property name="icon-name">preferences-other-symbolic</property> <property name="icon-name">preferences-other-symbolic</property>
<child> <child>
<object class="AdwPreferencesGroup"> <object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Model Tweaks</property> <!--<property name="title" translatable="yes">Model Tweaks</property>
<property name="description" translatable="yes">Manage the behavior of the AI models</property> <property name="description" translatable="yes">Manage the behavior of the AI models</property>-->
<child> <child>
<object class="AdwSpinRow" id="temperature_spin"> <object class="AdwSpinRow" id="temperature_spin">
<signal name="changed" handler="model_spin_changed"/> <signal name="changed" handler="model_spin_changed"/>
@ -362,7 +362,7 @@
<signal name="changed" handler="model_spin_changed"/> <signal name="changed" handler="model_spin_changed"/>
<property name="name">keep_alive</property> <property name="name">keep_alive</property>
<property name="title" translatable="yes">Keep Alive Time</property> <property name="title" translatable="yes">Keep Alive Time</property>
<property name="subtitle" translatable="yes">Controls how long the model will stay loaded into memory following the request in minutes (default: 5)</property> <property name="subtitle" translatable="yes">Controls how long the model will stay loaded into memory following the request in minutes (Default: 5)</property>
<property name="adjustment"> <property name="adjustment">
<object class="GtkAdjustment"> <object class="GtkAdjustment">
<property name="lower">-1</property> <property name="lower">-1</property>
@ -383,7 +383,7 @@
<child> <child>
<object class="AdwPreferencesGroup"> <object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Ollama Overrides</property> <property name="title" translatable="yes">Ollama Overrides</property>
<property name="description" translatable="yes">Manage the arguments used on Ollama, any changes on this page only applies to the integrated instance, the instance will restart if you make changes</property> <property name="description" translatable="yes">Manage the arguments used on Ollama, any changes on this page only applies to the integrated instance, the instance will restart if you make changes.</property>
<child> <child>
<object class="AdwEntryRow" id="override_HSA_OVERRIDE_GFX_VERSION"> <object class="AdwEntryRow" id="override_HSA_OVERRIDE_GFX_VERSION">
<signal name="apply" handler="override_changed"/> <signal name="apply" handler="override_changed"/>
@ -968,7 +968,7 @@
<attribute name="action">app.create_model_from_existing</attribute> <attribute name="action">app.create_model_from_existing</attribute>
</item> </item>
<item> <item>
<attribute name="label" translatable="yes">From GGUF file (Testing)</attribute> <attribute name="label" translatable="yes">From GGUF file (Experimental)</attribute>
<attribute name="action">app.create_model_from_file</attribute> <attribute name="action">app.create_model_from_file</attribute>
</item> </item>
</section> </section>