Will hide translation errors from user

This commit is contained in:
Raivis Dejus 2026-02-27 14:14:23 +02:00
commit af84cbdf40

View file

@ -76,7 +76,8 @@ class Translator(QObject):
return completion.choices[0].message.content, transcript_id
else:
logging.error(f"Translation error! Server response: {completion}")
return _("Translation error, see logs!"), transcript_id
# Translation error
return "", transcript_id
def _translate_batch(self, items: List[Tuple[str, int]]) -> List[Tuple[str, int]]:
"""Translate multiple transcripts in a single API call.
@ -109,7 +110,8 @@ class Translator(QObject):
if not (completion and completion.choices and completion.choices[0].message):
logging.error(f"Batch translation error! Server response: {completion}")
return [(_("Translation error, see logs!"), tid) for _, tid in items]
# Translation error
return [("", tid) for _, tid in items]
response_text = completion.choices[0].message.content
logging.debug(f"Received batch translation response: {response_text}")
@ -121,7 +123,8 @@ class Translator(QObject):
if i < len(translations):
results.append((translations[i], transcript_id))
else:
results.append((_("Translation error, see logs!"), transcript_id))
# Translation error
results.append(("", transcript_id))
return results
@staticmethod