Skip to content

Commit 62951e7

Browse files
authored
Merge pull request #222 from FrancescoCaracciolo/master
2 parents ccbb54d + e022c83 commit 62951e7

19 files changed

+57
-22
lines changed

data/icons/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ install_data(
1515
symbolic_dir = join_paths(get_option('datadir'), 'icons/hicolor/symbolic/apps')
1616
install_data (
1717
'internet-symbolic.svg',
18+
'view-show-symbolic.svg',
1819
'plus-symbolic.svg',
1920
'attach-symbolic.svg',
2021
'circle-crossed-symbolic.svg',

data/icons/view-show-symbolic.svg

Lines changed: 11 additions & 0 deletions
Loading

src/handlers/extra_settings.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def Setting(key: str, title: str, description: str, default: object, folder: str
4141

4242
@staticmethod
4343
def EntrySetting(key:str, title: str, description: str, default: str,
44-
folder: str|None = None, website: str|None = None, update_settings: bool = False, refresh: Callable|None = None, refresh_icon: str|None = None) -> dict:
44+
folder: str|None = None, website: str|None = None, update_settings: bool = False, refresh: Callable|None = None, refresh_icon: str|None = None, password: bool = False) -> dict:
4545
"""
4646
Create a new entry setting, which can be used to enter a string
4747
@@ -54,13 +54,15 @@ def EntrySetting(key:str, title: str, description: str, default: str,
5454
website: if not None, near the setting it will be shown a button to open the specified website
5555
update_settings: if True, when the setting is changed, the settings will be automatically updated
5656
refresh: if not None, near the setting it will be shown a button to refresh the specified function. When clicked the function is executed
57-
refresh_icon: if not None, the icon of the refresh button
57+
refresh_icon: if not None, the icon of the refresh button
58+
password: if True, the entry will be shown as a password
5859
5960
Returns:
6061
dict: the setting in this format
6162
"""
6263
r = ExtraSettings.Setting(key, title, description, default, folder, website, update_settings, refresh, refresh_icon)
6364
r["type"] = "entry"
65+
r["password"] = password
6466
return r
6567

6668
@staticmethod

src/handlers/llm/claude_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def get_models(self):
8181

8282
def get_extra_settings(self) -> list:
8383
settings = [
84-
ExtraSettings.EntrySetting("api", _("API Key"), _("The API key to use"), ""),
84+
ExtraSettings.EntrySetting("api", _("API Key"), _("The API key to use"), "", password=True),
8585
ExtraSettings.ToggleSetting("custom_model", _("Use a custom model"), _("Use a custom model"), False, update_settings=True),
8686
]
8787
if self.get_setting("custom_model", False):

src/handlers/llm/gemini_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def is_installed(self) -> bool:
9191

9292
def get_extra_settings(self) -> list:
9393
r = [
94-
ExtraSettings.EntrySetting("apikey", _("API Key (required)"), _("API key got from ai.google.dev"), ""),
94+
ExtraSettings.EntrySetting("apikey", _("API Key (required)"), _("API key got from ai.google.dev"), "", password=True),
9595
ExtraSettings.ComboSetting(
9696
"model",
9797
_("Model"),

src/handlers/llm/openai_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def build_extra_settings(self, provider_name: str, has_api_key: bool, has_stream
6969
list containing the extra settings
7070
"""
7171
api_settings = [
72-
ExtraSettings.EntrySetting("api", _("API Key"), _("API Key for " + provider_name), ""),
72+
ExtraSettings.EntrySetting("api", _("API Key"), _("API Key for " + provider_name), "", password=True),
7373
]
7474
endpoint_settings = [
7575
ExtraSettings.EntrySetting("endpoint", _("API Endpoint"), _("API base url, change this to use interference APIs"), "https://api.openai.com/v1/"),

src/handlers/stt/googlesr_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ def get_extra_settings(self) -> list:
1313
"title": _("API Key"),
1414
"description": _("API Key for Google SR, write 'default' to use the default one"),
1515
"type": "entry",
16-
"default": "default"
16+
"default": "default",
17+
"password": True,
1718
},
1819
{
1920
"key": "language",

src/handlers/stt/groqsr_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ def get_extra_settings(self) -> list:
1313
"title": _("API Key"),
1414
"description": _("API Key for Groq SR, write 'default' to use the default one"),
1515
"type": "entry",
16-
"default": "default"
16+
"default": "default",
17+
"password": True,
1718
},
1819
{
1920
"key": "model",

src/handlers/stt/openaisr_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def get_extra_settings(self) -> list:
1717
"title": _("API Key"),
1818
"description": _("API Key for OpenAI"),
1919
"type": "entry",
20-
"default": ""
20+
"default": "",
21+
"password": True,
2122
},
2223
{
2324
"key": "model",

src/handlers/stt/witai_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def get_extra_settings(self) -> list:
1212
"title": _("API Key"),
1313
"description": _("Server Access Token for wit.ai"),
1414
"type": "entry",
15-
"default": ""
15+
"default": "",
16+
"password": True,
1617
},
1718
]
1819

0 commit comments

Comments
 (0)