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 {
padding: 0;
}
.manage_models_button {
padding: 6px 8px 6px 8px;
}
.model_list_box > * {
margin: 0;
}

View File

@ -1287,6 +1287,7 @@ Generate a title following these rules:
self.chats["order"] = []
for chat_name in self.chats["chats"].keys():
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:
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):
@ -1382,6 +1383,7 @@ Generate a title following these rules:
menu_model=self.chat_right_click_menu,
has_arrow=False,
halign=1,
height_request=125
)
self.selected_chat_row = chat_row
position = Gdk.Rectangle()

View File

@ -99,25 +99,38 @@
</style>
<property name="popover">
<object class="GtkPopover" id="model_popover">
<property name="has-arrow">false</property>
<child>
<object class="GtkBox">
<property name="orientation">1</property>
<property name="spacing">10</property>
<property name="spacing">5</property>
<child>
<object class="GtkButton">
<property name="hexpand">true</property>
<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="tooltip-text" translatable="yes">Manage Models</property>
<property name="action-name">app.manage_models</property>
<signal name="clicked" handler="close_model_popup"/>
<style>
<class name="accent"/>
<class name="flat"/>
<class name="manage_models_button"/>
</style>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="max-content-height">300</property>
<property name="propagate-natural-width">true</property>
<property name="propagate-natural-height">true</property>
<child>
<object class="GtkListBox" id="model_list_box">
<property name="hexpand">true</property>
@ -130,6 +143,9 @@
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
@ -1105,10 +1121,7 @@ By downloading any model you accept their license agreement available on the mod
</section>
</menu>
<menu id="secondary_menu">
<item>
<attribute name="label" translatable="yes">Delete Chat</attribute>
<attribute name="action">app.delete_current_chat</attribute>
</item>
<section>
<item>
<attribute name="label" translatable="yes">Rename Chat</attribute>
<attribute name="action">app.rename_current_chat</attribute>
@ -1121,13 +1134,16 @@ By downloading any model you accept their license agreement available on the mod
<attribute name="label" translatable="yes">Clear Chat</attribute>
<attribute name="action">app.clear</attribute>
</item>
</menu>
<menu id="chat_right_click_menu">
</section>
<section>
<item>
<attribute name="label" translatable="yes">Delete Chat</attribute>
<attribute name="action">app.delete_chat</attribute>
<attribute name="action">app.delete_current_chat</attribute>
</item>
</section>
</menu>
<menu id="chat_right_click_menu">
<section>
<item>
<attribute name="label" translatable="yes">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>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Delete Chat</attribute>
<attribute name="action">app.delete_chat</attribute>
</item>
</section>
</menu>
<menu id="create_model_menu">
<section>