Skip to content

Commit

Permalink
Merge pull request #115 from FrancescoCaracciolo/master
Browse files Browse the repository at this point in the history
  • Loading branch information
qwersyk authored Dec 27, 2024
2 parents f52a719 + 36af0a8 commit 8a3717a
Show file tree
Hide file tree
Showing 6 changed files with 417 additions and 51 deletions.
1 change: 1 addition & 0 deletions data/icons/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ install_data(
symbolic_dir = join_paths(get_option('datadir'), 'icons/hicolor/symbolic/apps')
install_data (
'internet-symbolic.svg',
'plus-symbolic.svg',
'attach-symbolic.svg',
'circle-crossed-symbolic.svg',
'check-plain-symbolic.svg',
Expand Down
2 changes: 2 additions & 0 deletions data/icons/plus-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@
"local": {
"key": "local",
"title": _("Local Model"),
"description": _("Run a LLM model locally, more privacy but slower"),
"description": _("NO GPU SUPPORT, USE OLLAMA INSTEAD. Run a LLM model locally, more privacy but slower"),
"class": GPT4AllHandler,
},
"ollama": {
"key": "ollama",
"title": _("Ollama Instance"),
"description": _("Easily run multiple LLM models on your own hardware"),
"class": OllamaHandler,
"website": "https://ollama.com/",
},
"groq": {
"key": "groq",
"title": _("Groq"),
"description": "Official Groq API",
"description": "Groq.com Free and fast API using open source models. Suggested for free use.",
"class": GroqHandler,
"website": "https://console.groq.com/",
},
"gemini": {
"key": "gemini",
Expand Down
24 changes: 23 additions & 1 deletion src/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,32 @@ def get_extra_settings(self) -> list:
- range: for number input with a slider
- min: minimum value
- max: maximum value
- round: how many digits to round
- round: how many digits to round
- nested: an expander row with nested extra settings
- extra_settings: list of extra_settings
- download: install something showing the downoad process
- is_installed: bool, true if the module is installed, false otherwise
- callback: the function to run on press to download/delete. The download must happen in sync
- download_percentage: callable that takes the key and returns the download percentage as float
Optional parameters:
- folder: add a button that opens a folder with the specified path
- website: add a button that opens a website with the specified path
- update_settings (bool) if reload the settings in the settings page for the specified handler after that setting change
- refresh (callable) adds a refresh button in the row to reload the settings in the settings page for the specified handler
- refresh_icon(str): name of the icon for the refresh button
"""
return []

def get_extra_settings_list(self) -> list:
"""Get the list of extra settings"""
res = []
for setting in self.get_extra_settings():
if setting["type"] == "nested":
res += setting["extra_settings"]
else:
res.append(setting)
return res

@staticmethod
def get_extra_requirements() -> list:
"""The list of extra pip requirements needed by the handler"""
Expand Down Expand Up @@ -102,6 +120,10 @@ def get_default_setting(self, key) -> object:
"""
extra_settings = self.get_extra_settings()
for s in extra_settings:
if s["type"] == "nested":
for setting in s["extra_settings"]:
if setting["key"] == key:
return setting["default"]
if s["key"] == key:
return s["default"]
return None
Expand Down
Loading

0 comments on commit 8a3717a

Please sign in to comment.