mirror of
https://github.com/chidiwilliams/buzz.git
synced 2026-03-14 22:55:46 +01:00
Will hide translation errors from user
This commit is contained in:
parent
885d144e92
commit
af84cbdf40
1 changed files with 6 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue