New model selector design + moved around the delete chat option on menus

This commit is contained in:
jeffser 2024-08-06 12:59:41 -06:00
parent 7fbc9b9bde
commit c02e6a565e
3 changed files with 56 additions and 29 deletions

View File

@ -15,6 +15,9 @@
.model_list_box { .model_list_box {
padding: 0; padding: 0;
} }
.manage_models_button {
padding: 6px 8px 6px 8px;
}
.model_list_box > * { .model_list_box > * {
margin: 0; margin: 0;
} }

View File

@ -1287,6 +1287,7 @@ Generate a title following these rules:
self.chats["order"] = [] self.chats["order"] = []
for chat_name in self.chats["chats"].keys(): for chat_name in self.chats["chats"].keys():
self.chats["order"].append(chat_name) self.chats["order"].append(chat_name)
self.model_list_box.select_row(self.model_list_box.get_row_at_index(0))
if len(self.chats["chats"][self.chats["selected_chat"]]["messages"].keys()) > 0: 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.chats["chats"][self.chats["selected_chat"]]["messages"][list(self.chats["chats"][self.chats["selected_chat"]]["messages"].keys())[-1]]["model"]
for i, m in enumerate(self.local_models): for i, m in enumerate(self.local_models):
@ -1382,6 +1383,7 @@ Generate a title following these rules:
menu_model=self.chat_right_click_menu, menu_model=self.chat_right_click_menu,
has_arrow=False, has_arrow=False,
halign=1, halign=1,
height_request=125
) )
self.selected_chat_row = chat_row self.selected_chat_row = chat_row
position = Gdk.Rectangle() position = Gdk.Rectangle()

View File

@ -99,19 +99,27 @@
</style> </style>
<property name="popover"> <property name="popover">
<object class="GtkPopover" id="model_popover"> <object class="GtkPopover" id="model_popover">
<property name="has-arrow">false</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="orientation">1</property> <property name="orientation">1</property>
<property name="spacing">10</property> <property name="spacing">5</property>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="child">
<object class="GtkLabel">
<property name="label" translatable="yes">Manage Models</property>
<property name="justify">left</property>
<property name="halign">1</property>
</object>
</property>
<property name="hexpand">true</property> <property name="hexpand">true</property>
<property name="label" translatable="yes">Manage Models</property>
<property name="tooltip-text" translatable="yes">Manage Models</property> <property name="tooltip-text" translatable="yes">Manage Models</property>
<property name="action-name">app.manage_models</property> <property name="action-name">app.manage_models</property>
<signal name="clicked" handler="close_model_popup"/> <signal name="clicked" handler="close_model_popup"/>
<style> <style>
<class name="accent"/> <class name="flat"/>
<class name="manage_models_button"/>
</style> </style>
</object> </object>
</child> </child>
@ -119,15 +127,23 @@
<object class="GtkSeparator"/> <object class="GtkSeparator"/>
</child> </child>
<child> <child>
<object class="GtkListBox" id="model_list_box"> <object class="GtkScrolledWindow">
<property name="hexpand">true</property> <property name="max-content-height">300</property>
<style> <property name="propagate-natural-width">true</property>
<class name="navigation-sidebar"/> <property name="propagate-natural-height">true</property>
<class name="model_list_box"/> <child>
</style> <object class="GtkListBox" id="model_list_box">
<signal name="row-selected" handler="change_model"/> <property name="hexpand">true</property>
<style>
<class name="navigation-sidebar"/>
<class name="model_list_box"/>
</style>
<signal name="row-selected" handler="change_model"/>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
</object> </object>
@ -1105,29 +1121,29 @@ By downloading any model you accept their license agreement available on the mod
</section> </section>
</menu> </menu>
<menu id="secondary_menu"> <menu id="secondary_menu">
<item> <section>
<attribute name="label" translatable="yes">Delete Chat</attribute> <item>
<attribute name="action">app.delete_current_chat</attribute> <attribute name="label" translatable="yes">Rename Chat</attribute>
</item> <attribute name="action">app.rename_current_chat</attribute>
<item> </item>
<attribute name="label" translatable="yes">Rename Chat</attribute> <item>
<attribute name="action">app.rename_current_chat</attribute> <attribute name="label" translatable="yes">Export Chat</attribute>
</item> <attribute name="action">app.export_current_chat</attribute>
<item> </item>
<attribute name="label" translatable="yes">Export Chat</attribute> <item>
<attribute name="action">app.export_current_chat</attribute> <attribute name="label" translatable="yes">Clear Chat</attribute>
</item> <attribute name="action">app.clear</attribute>
<item> </item>
<attribute name="label" translatable="yes">Clear Chat</attribute> </section>
<attribute name="action">app.clear</attribute>
</item>
</menu>
<menu id="chat_right_click_menu">
<section> <section>
<item> <item>
<attribute name="label" translatable="yes">Delete Chat</attribute> <attribute name="label" translatable="yes">Delete Chat</attribute>
<attribute name="action">app.delete_chat</attribute> <attribute name="action">app.delete_current_chat</attribute>
</item> </item>
</section>
</menu>
<menu id="chat_right_click_menu">
<section>
<item> <item>
<attribute name="label" translatable="yes">Rename Chat</attribute> <attribute name="label" translatable="yes">Rename Chat</attribute>
<attribute name="action">app.rename_chat</attribute> <attribute name="action">app.rename_chat</attribute>
@ -1137,6 +1153,12 @@ By downloading any model you accept their license agreement available on the mod
<attribute name="action">app.export_chat</attribute> <attribute name="action">app.export_chat</attribute>
</item> </item>
</section> </section>
<section>
<item>
<attribute name="label" translatable="yes">Delete Chat</attribute>
<attribute name="action">app.delete_chat</attribute>
</item>
</section>
</menu> </menu>
<menu id="create_model_menu"> <menu id="create_model_menu">
<section> <section>