Skip to content

Commit

Permalink
Optimize settings opening
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoCaracciolo committed Nov 26, 2024
1 parent 7ba5547 commit 58b4ca9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def get_extra_requirements() -> list:
return ["g4f"]

def is_installed(self) -> bool:
return False
if find_module("g4f") is not None:
from g4f.version import utils
if utils.current_version != self.version:
Expand Down Expand Up @@ -761,6 +762,9 @@ def get_models(self):
def get_extra_requirements() -> list:
return ["openai"]

def is_installed(self):
return True

def supports_vision(self) -> bool:
return True

Expand Down Expand Up @@ -1038,6 +1042,9 @@ def __init__(self, settings, path):
self.set_setting("advanced_params", False)
self.set_setting("api", "nya")

def get_models(self):
pass

def get_extra_settings(self) -> list:
return self.build_extra_settings("Nyarch",False, True, False, False, False, None, None, False, False)

Expand Down
7 changes: 4 additions & 3 deletions src/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ def __init__(self,app,headless=False, *args, **kwargs):
help = Gtk.Button(css_classes=["flat"], icon_name="info-outline-symbolic")
help.connect("clicked", lambda button : Popen(get_spawn_command() + ["xdg-open", "https://github.com/qwersyk/Newelle/wiki/User-guide-to-the-available-LLMs"]))
self.LLM.set_header_suffix(help)

# Add LLMs
self.general_page.add(self.LLM)
self.llmbuttons = [];
self.llmbuttons = []
group = Gtk.CheckButton()
selected = self.settings.get_string("language-model")
others_row = Adw.ExpanderRow(title=_('Other LLMs'), subtitle=_("Other available LLM providers"))
for model_key in AVAILABLE_LLMS:
for model_key in AVAILABLE_LLMS:
# Time enlapse calculation
row = self.build_row(AVAILABLE_LLMS, model_key, selected, group)
if "secondary" in AVAILABLE_LLMS[model_key] and AVAILABLE_LLMS[model_key]["secondary"]:
others_row.add_row(row)
Expand All @@ -87,7 +89,6 @@ def __init__(self,app,headless=False, *args, **kwargs):
for tts_key in AVAILABLE_TTS:
row = self.build_row(AVAILABLE_TTS, tts_key, selected, group)
tts_program.add_row(row)

# Build the Translators settings
group = Gtk.CheckButton()
selected = self.settings.get_string("translator")
Expand Down
3 changes: 2 additions & 1 deletion src/smart_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def get_extra_settings(self) -> list:
{
"key": "dimension",
"title": _("Model Dimension"),
"description": _("Use bigger models for bigger accuracy, models bigger than 256 will donwnload on first message sent, < 100MB"),
"description": _("Use bigger models for bigger accuracy less than 100MB"),
"type": "combo",
"default": 256,
"values": (("NyaMedium_0.3_256","256"), ("NyaMedium_0.3_512","512"), ("NyaMedium_0.3_1024", "1024"),)
Expand Down Expand Up @@ -140,6 +140,7 @@ def load(self):
self.model = pickle.load(f)

def is_installed(self) -> bool:
return True
if not find_module("sklearn"):
return False
if not os.path.isfile(self.model_path):
Expand Down

0 comments on commit 58b4ca9

Please sign in to comment.