Added description to model list and change it to JSON file

This commit is contained in:
jeffser 2024-06-25 00:36:02 -06:00
parent 8bf8ca1b90
commit ce3dce4c67
7 changed files with 9 additions and 18 deletions

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/com/jeffser/Alpaca">
<file>style.css</file>
<file alias="icons/scalable/status/library-symbolic.svg">icons/library-symbolic.svg</file>
<file alias="icons/scalable/status/paper-plane-symbolic.svg">icons/paper-plane-symbolic.svg</file>
<file alias="icons/scalable/status/globe-symbolic.svg">icons/globe-symbolic.svg</file>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,6 @@
# dialogs.py
from gi.repository import Adw, Gtk, Gdk, GLib, GtkSource, Gio, GdkPixbuf
from .available_models import available_models
# CLEAR CHAT | WORKS
@ -153,7 +152,7 @@ def pull_model_response(self, dialog, task, model_name, tag_drop_down):
def pull_model(self, model_name):
tag_list = Gtk.StringList()
for tag in available_models[model_name]['tags']:
for tag in self.available_models[model_name]['tags']:
tag_list.append(f"{tag[0]} | {tag[1]}")
tag_drop_down = Gtk.DropDown(
enable_search=True,

View File

@ -40,10 +40,10 @@ alpaca_sources = [
'main.py',
'window.py',
'connection_handler.py',
'available_models.py',
'dialogs.py',
'local_instance.py',
'update_history.py'
'update_history.py',
'available_models.json'
]
install_data(alpaca_sources, install_dir: moduledir)

View File

@ -1,7 +0,0 @@
.message .delete-message-button {
opacity: 0;
transition: opacity .05s;
}
.message:hover .delete-message-button {
opacity: 1;
}

View File

@ -28,7 +28,6 @@ from io import BytesIO
from PIL import Image
from pypdf import PdfReader
from datetime import datetime
from .available_models import available_models
from . import dialogs, local_instance, connection_handler, update_history
@Gtk.Template(resource_path='/com/jeffser/Alpaca/window.ui')
@ -48,6 +47,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
_ = gettext.gettext
#Variables
available_models = None
run_on_background = False
remote_url = ""
run_remote = False
@ -861,10 +861,10 @@ class AlpacaWindow(Adw.ApplicationWindow):
def update_list_available_models(self):
self.available_model_list_box.remove_all()
for name, model_info in available_models.items():
for name, model_info in self.available_models.items():
model = Adw.ActionRow(
title = name,
subtitle = "Image recognition" if model_info["image"] else None
subtitle = (_("(Image recognition capable)\n") if model_info["image"] else "") + model_info['description']
)
link_button = Gtk.Button(
icon_name = "globe-symbolic",
@ -1271,6 +1271,8 @@ class AlpacaWindow(Adw.ApplicationWindow):
def __init__(self, **kwargs):
super().__init__(**kwargs)
GtkSource.init()
with open('/app/share/Alpaca/alpaca/available_models.json', 'r') as f:
self.available_models = json.load(f)
if not os.path.exists(os.path.join(self.data_dir, "chats")):
os.makedirs(os.path.join(self.data_dir, "chats"))
if os.path.exists(os.path.join(self.config_dir, "chats.json")) and not os.path.exists(os.path.join(self.data_dir, "chats", "chats.json")):