Added 'Feature Models' page on welcome dialog

This commit is contained in:
jeffser 2024-05-26 14:10:20 -06:00
parent 92dd56b0c4
commit 074b4dc643
2 changed files with 103 additions and 2 deletions

View File

@ -194,8 +194,8 @@ class AlpacaWindow(Adw.ApplicationWindow):
def welcome_carousel_page_changed(self, carousel, index):
if index == 0: self.welcome_previous_button.set_sensitive(False)
else: self.welcome_previous_button.set_sensitive(True)
if index == carousel.get_n_pages()-1: self.welcome_next_button.set_label("Connect")
else: self.welcome_next_button.set_label("Next")
if index == carousel.get_n_pages()-1: self.welcome_next_button.set_label(_("Close"))
else: self.welcome_next_button.set_label(_("Next"))
@Gtk.Template.Callback()
def welcome_previous_button_activate(self, button):
@ -237,6 +237,19 @@ class AlpacaWindow(Adw.ApplicationWindow):
entry.set_css_classes(["error"])
self.show_toast("error", 1, self.preferences_dialog)
@Gtk.Template.Callback()
def pull_featured_model(self, button):
action_row = button.get_parent().get_parent().get_parent()
button.get_parent().remove(button)
model = f"{action_row.get_title().lower()}:latest"
action_row.set_subtitle(_("Pulling in the background..."))
spinner = Gtk.Spinner()
spinner.set_spinning(True)
action_row.add_suffix(spinner)
action_row.set_sensitive(False)
self.pull_model(model)
def show_toast(self, message_type:str, message_id:int, overlay):
if message_type not in self.toast_messages or message_id > len(self.toast_messages[message_type] or message_id < 0):
message_type = "error"

View File

@ -441,6 +441,94 @@
<property name="description" translatable="yes">Alpaca and its developers are not liable for any damages to devices or software resulting from the execution of code generated by an AI model. Please exercise caution and review the code carefully before running it.</property>
</object>
</child>
<child>
<object class="AdwStatusPage">
<property name="hexpand">true</property>
<property name="vexpand">true</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="title" translatable="yes">Featured Models</property>
<property name="description" translatable="yes">Alpaca works locally on your device, to start chatting you'll need an AI model, you can either pull models from this list or the 'Manage Models' menu later.</property>
<child>
<object class="GtkListBox">
<property name="selection-mode">none</property>
<style>
<class name="boxed-list"/>
</style>
<child>
<object class="AdwActionRow">
<property name="title" translatable="no">Llama3</property>
<property name="subtitle" translatable="yes">Built by Meta</property>
<child type="suffix">
<object class="GtkButton">
<signal name="clicked" handler="pull_featured_model"/>
<property name="vexpand">false</property>
<property name="icon-name">folder-download-symbolic</property>
<property name="valign">3</property>
<style>
<class name="accent"/>
</style>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="no">Gemma</property>
<property name="subtitle" translatable="yes">Built by Google DeepMind</property>
<child type="suffix">
<object class="GtkButton">
<signal name="clicked" handler="pull_featured_model"/>
<property name="vexpand">false</property>
<property name="icon-name">folder-download-symbolic</property>
<property name="valign">3</property>
<style>
<class name="accent"/>
</style>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="no">Phi3</property>
<property name="subtitle" translatable="yes">Built by Microsoft</property>
<child type="suffix">
<object class="GtkButton">
<signal name="clicked" handler="pull_featured_model"/>
<property name="vexpand">false</property>
<property name="icon-name">folder-download-symbolic</property>
<property name="valign">3</property>
<style>
<class name="accent"/>
</style>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow">
<property name="title" translatable="no">Llava</property>
<property name="subtitle" translatable="yes">Multimodal AI with image recognition</property>
<child type="suffix">
<object class="GtkButton">
<signal name="clicked" handler="pull_featured_model"/>
<property name="vexpand">false</property>
<property name="icon-name">folder-download-symbolic</property>
<property name="valign">3</property>
<style>
<class name="accent"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>