Skip to content

Commit

Permalink
Fix for API key check (#1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
raivisdejus authored Jan 9, 2025
1 parent 32945e0 commit e76c1bb
Show file tree
Hide file tree
Showing 13 changed files with 386 additions and 78 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Linux versions get also pushed to the snap. To install latest development versio

1. Clone the repository `git clone --recursive https://github.com/chidiwilliams/buzz.git`
2. Enter repo folder `cd buzz`
3. Install Poetry `sudo apt-get install python3-poetry`
3. Install Poetry `pipx install poetry`
4. Activate the virtual environment `poetry shell`
5. Install the dependencies `poetry install`
6. Install system dependencies you may be missing
Expand Down
14 changes: 7 additions & 7 deletions buzz/locale/ca_ES/LC_MESSAGES/buzz.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: buzz\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-02 11:39+0200\n"
"POT-Creation-Date: 2025-01-09 08:48+0200\n"
"PO-Revision-Date: 2023-02-15 05:01+0000\n"
"Last-Translator: Jordi Mas i Hernàndez <[email protected]>\n"
"Language-Team: Catalan <[email protected]>\n"
Expand Down Expand Up @@ -107,21 +107,21 @@ msgid ""
"transcriptions and AI translations."
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:173
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:178
msgid "Invalid API key"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:174
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:179
msgid ""
"API supports only base64 characters (A-Za-z0-9+/=). Other characters in API "
"key may cause errors."
"API supports only base64 characters (A-Za-z0-9+/=_-). Other characters in "
"API key may cause errors."
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:192
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:197
msgid "Select Export Folder"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:244
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:249
msgid ""
"OpenAI API returned invalid response. Please check the API url or your key. "
"Transcription and translation may still work if the API does not support key "
Expand Down
14 changes: 7 additions & 7 deletions buzz/locale/es_ES/LC_MESSAGES/buzz.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-02 11:39+0200\n"
"POT-Creation-Date: 2025-01-09 08:48+0200\n"
"PO-Revision-Date: 2023-11-09 04:35-0600\n"
"Last-Translator: Adolfo Jayme Barrientos <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -109,21 +109,21 @@ msgid ""
"transcriptions and AI translations."
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:173
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:178
msgid "Invalid API key"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:174
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:179
msgid ""
"API supports only base64 characters (A-Za-z0-9+/=). Other characters in API "
"key may cause errors."
"API supports only base64 characters (A-Za-z0-9+/=_-). Other characters in "
"API key may cause errors."
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:192
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:197
msgid "Select Export Folder"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:244
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:249
msgid ""
"OpenAI API returned invalid response. Please check the API url or your key. "
"Transcription and translation may still work if the API does not support key "
Expand Down
15 changes: 8 additions & 7 deletions buzz/locale/it_IT/LC_MESSAGES/buzz.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: buzz\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-02 11:39+0200\n"
"POT-Creation-Date: 2025-01-09 08:48+0200\n"
"PO-Revision-Date: 2024-11-24 13:22+0100\n"
"Language-Team: (Italiano) Albano Battistella <[email protected]>\n"
"Language: it_IT\n"
Expand Down Expand Up @@ -107,23 +107,24 @@ msgstr ""
"La tua chiave API è valida. Buzz utilizzerà questa chiave per eseguire le "
"trascrizioni API Whisper e le traduzioni AI."

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:173
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:178
msgid "Invalid API key"
msgstr "Chiave API non valida"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:174
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:179
#, fuzzy
msgid ""
"API supports only base64 characters (A-Za-z0-9+/=). Other characters in API "
"key may cause errors."
"API supports only base64 characters (A-Za-z0-9+/=_-). Other characters in "
"API key may cause errors."
msgstr ""
"L'API supporta solo caratteri base64 (A-Za-z0-9+/=). Altri caratteri nella "
"chiave API potrebbero causare errori."

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:192
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:197
msgid "Select Export Folder"
msgstr "Seleziona la cartella di esportazione"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:244
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:249
msgid ""
"OpenAI API returned invalid response. Please check the API url or your key. "
"Transcription and translation may still work if the API does not support key "
Expand Down
14 changes: 7 additions & 7 deletions buzz/locale/ja_JP/LC_MESSAGES/buzz.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-02 11:39+0200\n"
"POT-Creation-Date: 2025-01-09 08:48+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: nunawa <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -104,22 +104,22 @@ msgstr ""
"あなたのAPIキーは有効です。Buzzはこのキーを使ってWhisper APIの書き起こしとAI"
"翻訳を行います。"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:173
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:178
#, fuzzy
msgid "Invalid API key"
msgstr "OpenAI APIキー"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:174
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:179
msgid ""
"API supports only base64 characters (A-Za-z0-9+/=). Other characters in API "
"key may cause errors."
"API supports only base64 characters (A-Za-z0-9+/=_-). Other characters in "
"API key may cause errors."
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:192
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:197
msgid "Select Export Folder"
msgstr "出力フォルダを選択"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:244
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:249
msgid ""
"OpenAI API returned invalid response. Please check the API url or your key. "
"Transcription and translation may still work if the API does not support key "
Expand Down
20 changes: 10 additions & 10 deletions buzz/locale/lv_LV/LC_MESSAGES/buzz.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-02 11:39+0200\n"
"PO-Revision-Date: 2025-01-02 11:46+0200\n"
"POT-Creation-Date: 2025-01-09 08:48+0200\n"
"PO-Revision-Date: 2025-01-09 08:49+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: lv_LV\n"
Expand Down Expand Up @@ -111,23 +111,23 @@ msgstr ""
"Jūsu API atslēga ir derīga. Buzz izmantos to runas atpazīšanai ar Whisper "
"API un tulkošanai."

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:173
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:178
msgid "Invalid API key"
msgstr "Nederīga API atslēga"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:174
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:179
msgid ""
"API supports only base64 characters (A-Za-z0-9+/=). Other characters in API "
"key may cause errors."
"API supports only base64 characters (A-Za-z0-9+/=_-). Other characters in "
"API key may cause errors."
msgstr ""
"API atbalsta tikai base64 simbolus (A-Za-z0-9+/=). Citi simboli API atslēgā "
"var radīt kļūdas."
"API atbalsta tikai base64 simbolus (A-Za-z0-9+/=_-). Citi simboli API "
"atslēgā var radīt kļūdas."

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:192
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:197
msgid "Select Export Folder"
msgstr "Izvēlieties mapi kurā eksportēt"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:244
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:249
msgid ""
"OpenAI API returned invalid response. Please check the API url or your key. "
"Transcription and translation may still work if the API does not support key "
Expand Down
14 changes: 7 additions & 7 deletions buzz/locale/pl_PL/LC_MESSAGES/buzz.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-02 11:39+0200\n"
"POT-Creation-Date: 2025-01-09 08:48+0200\n"
"PO-Revision-Date: 2024-03-17 20:50+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down Expand Up @@ -107,22 +107,22 @@ msgid ""
"transcriptions and AI translations."
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:173
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:178
#, fuzzy
msgid "Invalid API key"
msgstr "Nieprawidłowy URL"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:174
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:179
msgid ""
"API supports only base64 characters (A-Za-z0-9+/=). Other characters in API "
"key may cause errors."
"API supports only base64 characters (A-Za-z0-9+/=_-). Other characters in "
"API key may cause errors."
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:192
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:197
msgid "Select Export Folder"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:244
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:249
msgid ""
"OpenAI API returned invalid response. Please check the API url or your key. "
"Transcription and translation may still work if the API does not support key "
Expand Down
14 changes: 7 additions & 7 deletions buzz/locale/uk_UA/LC_MESSAGES/buzz.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-02 11:39+0200\n"
"POT-Creation-Date: 2025-01-09 08:48+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: Yevhen Popok <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -106,22 +106,22 @@ msgstr ""
"Ваш API-ключ дійсний. Buzz використає цей ключ для транскрипції з Whisper "
"API та перекладу ШІ."

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:173
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:178
#, fuzzy
msgid "Invalid API key"
msgstr "API-ключ OpenAI"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:174
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:179
msgid ""
"API supports only base64 characters (A-Za-z0-9+/=). Other characters in API "
"key may cause errors."
"API supports only base64 characters (A-Za-z0-9+/=_-). Other characters in "
"API key may cause errors."
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:192
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:197
msgid "Select Export Folder"
msgstr "Виберіть теку для експорту"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:244
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:249
msgid ""
"OpenAI API returned invalid response. Please check the API url or your key. "
"Transcription and translation may still work if the API does not support key "
Expand Down
15 changes: 8 additions & 7 deletions buzz/locale/zh_CN/LC_MESSAGES/buzz.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-02 11:39+0200\n"
"POT-Creation-Date: 2025-01-09 08:48+0200\n"
"PO-Revision-Date: 2023-05-01 15:45+0800\n"
"Last-Translator: \n"
"Language-Team: lamb \n"
Expand Down Expand Up @@ -107,22 +107,23 @@ msgid ""
"transcriptions and AI translations."
msgstr "您的API密钥有效。Buzz将使用此密钥执行 Whisper API 识别和 AI 翻译。"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:173
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:178
msgid "Invalid API key"
msgstr "无效的API key"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:174
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:179
#, fuzzy
msgid ""
"API supports only base64 characters (A-Za-z0-9+/=). Other characters in API "
"key may cause errors."
"API supports only base64 characters (A-Za-z0-9+/=_-). Other characters in "
"API key may cause errors."
msgstr ""
"API只支持 base64字符(A-Za-z0-9+/=)。其他字符在API密钥中可能导致错误。"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:192
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:197
msgid "Select Export Folder"
msgstr "选择输出文件夹"

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:244
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:249
msgid ""
"OpenAI API returned invalid response. Please check the API url or your key. "
"Transcription and translation may still work if the API does not support key "
Expand Down
14 changes: 7 additions & 7 deletions buzz/locale/zh_TW/LC_MESSAGES/buzz.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-02 11:39+0200\n"
"POT-Creation-Date: 2025-01-09 08:48+0200\n"
"PO-Revision-Date: 2023-05-01 15:45+0800\n"
"Last-Translator: \n"
"Language-Team: Lamb\n"
Expand Down Expand Up @@ -107,21 +107,21 @@ msgid ""
"transcriptions and AI translations."
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:173
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:178
msgid "Invalid API key"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:174
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:179
msgid ""
"API supports only base64 characters (A-Za-z0-9+/=). Other characters in API "
"key may cause errors."
"API supports only base64 characters (A-Za-z0-9+/=_-). Other characters in "
"API key may cause errors."
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:192
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:197
msgid "Select Export Folder"
msgstr ""

#: buzz/widgets/preferences_dialog/general_preferences_widget.py:244
#: buzz/widgets/preferences_dialog/general_preferences_widget.py:249
msgid ""
"OpenAI API returned invalid response. Please check the API url or your key. "
"Transcription and translation may still work if the API does not support key "
Expand Down
4 changes: 2 additions & 2 deletions buzz/widgets/preferences_dialog/general_preferences_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from buzz.locale import _
from buzz.settings.recording_transcriber_mode import RecordingTranscriberMode

BASE64_PATTERN = re.compile(r'^[A-Za-z0-9+/=]*$')
BASE64_PATTERN = re.compile(r'^[A-Za-z0-9+/=_-]*$')


class GeneralPreferencesWidget(QWidget):
Expand Down Expand Up @@ -171,7 +171,7 @@ def on_openai_api_key_focus_out(self):
QMessageBox.warning(
self,
_("Invalid API key"),
_("API supports only base64 characters (A-Za-z0-9+/=). Other characters in API key may cause errors."),
_("API supports only base64 characters (A-Za-z0-9+/=_-). Other characters in API key may cause errors."),
)

def on_custom_openai_base_url_changed(self, text: str):
Expand Down
Loading

0 comments on commit e76c1bb

Please sign in to comment.