diff --git a/buzz/locale/lv_LV/LC_MESSAGES/buzz.po b/buzz/locale/lv_LV/LC_MESSAGES/buzz.po index 21cc551fd..3c61b2b1c 100644 --- a/buzz/locale/lv_LV/LC_MESSAGES/buzz.po +++ b/buzz/locale/lv_LV/LC_MESSAGES/buzz.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-02 22:07+0300\n" -"PO-Revision-Date: 2024-07-02 22:09+0300\n" +"POT-Creation-Date: 2024-07-11 19:46+0300\n" +"PO-Revision-Date: 2024-07-11 19:48+0300\n" "Last-Translator: \n" "Language-Team: \n" "Language: lv_LV\n" @@ -97,18 +97,24 @@ msgstr "OpenAI API atslēgas pārbaude" #: buzz/widgets/preferences_dialog/general_preferences_widget.py:139 msgid "" "Your API key is valid. Buzz will use this key to perform Whisper API " -"transcriptions and AI translations with ChatGPT." +"transcriptions and AI translations." msgstr "" "Jūsu API atslēga ir derīga. Buzz izmantos to runas atpazīšanai ar Whisper " -"API un tulkošanai ar ChatGPT." +"API un tulkošanai." #: buzz/widgets/preferences_dialog/general_preferences_widget.py:166 msgid "Select Export Folder" msgstr "Izvēlieties mapi kurā eksportēt" -#: buzz/widgets/preferences_dialog/general_preferences_widget.py:207 -msgid "OpenAI API returned invalid response, status code: " -msgstr "OpenAI API atbildēja ar nederīgu atbildi, statusa kods: " +#: buzz/widgets/preferences_dialog/general_preferences_widget.py:216 +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 " +"validation." +msgstr "" +"OpenAI API atbilde ir nederīga. Lūdzu pārbaudiet API Adresi un savu atslēgu. " +"Atpazīšana un tulkošana joprojām var strādāt, ja API neatbalsta atslēgu " +"pārbaudi. " #: buzz/widgets/preferences_dialog/folder_watch_preferences_widget.py:42 msgid "Enable folder watch" @@ -195,7 +201,7 @@ msgid "Download failed" msgstr "Lejupielāde neizdevās" #: buzz/widgets/preferences_dialog/models_preferences_widget.py:259 -#: buzz/widgets/main_window.py:291 buzz/model_loader.py:450 +#: buzz/widgets/main_window.py:291 buzz/model_loader.py:462 msgid "Error" msgstr "Kļūda" @@ -519,7 +525,7 @@ msgstr "Neizdevās saglabāt OpenAI API atslēgu atslēgu saišķī" msgid "Transcribe" msgstr "Atpazīt" -#: buzz/model_loader.py:478 +#: buzz/model_loader.py:490 msgid "A connection error occurred" msgstr "Notika savienojuma kļūda" diff --git a/buzz/widgets/preferences_dialog/general_preferences_widget.py b/buzz/widgets/preferences_dialog/general_preferences_widget.py index 184a4491d..72b87686e 100644 --- a/buzz/widgets/preferences_dialog/general_preferences_widget.py +++ b/buzz/widgets/preferences_dialog/general_preferences_widget.py @@ -136,7 +136,7 @@ def on_test_openai_api_key_success(self): QMessageBox.information( self, _("OpenAI API Key Test"), - _("Your API key is valid. Buzz will use this key to perform Whisper API transcriptions and AI translations with ChatGPT."), + _("Your API key is valid. Buzz will use this key to perform Whisper API transcriptions and AI translations."), ) def on_test_openai_api_key_failure(self, error: str): @@ -201,10 +201,20 @@ def run(self): if custom_openai_base_url: try: - response = requests.get(custom_openai_base_url) + if not custom_openai_base_url.endswith("/"): + custom_openai_base_url += "/" + + headers = { + "Authorization": f"Bearer {self.api_key}", + "Content-Type": "application/json" + } + + response = requests.get(custom_openai_base_url + "models", headers=headers, timeout=5) + if response.status_code != 200: self.signals.failed.emit( - _("OpenAI API returned invalid response, status code: ") + str(response.status_code) + _("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 validation.") ) return except requests.exceptions.RequestException as exc: @@ -214,7 +224,8 @@ def run(self): try: client = OpenAI( api_key=self.api_key, - base_url=custom_openai_base_url if custom_openai_base_url else None + base_url=custom_openai_base_url if custom_openai_base_url else None, + timeout=5, ) client.models.list() self.signals.success.emit()