refac
This commit is contained in:
1 parent
b6b16d5871
commit
810378c0b8
93 files changed
+440
-12
No files matched your search
@@ -330,6 +330,9 @@ def load_speech_pipeline(request):
|
||||
async def _raise_tts_error(exc: Exception, r=None) -> None:
|
||||
"""Raise a standardised HTTPException from a TTS provider failure."""
|
||||
code = r.status if r is not None else 500
|
||||
# LICENSE covers this Open WebUI error identifier.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
detail = 'Open WebUI: Server Connection Error'
|
||||
if r is not None:
|
||||
try:
|
||||
@@ -711,6 +714,9 @@ async def _transcribe_openai(request, file_path, filename, languages, file_dir,
|
||||
detail = f'External: {res["error"].get("message", "")}'
|
||||
except Exception:
|
||||
detail = f'External: {e}'
|
||||
# LICENSE covers this Open WebUI error identifier.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
raise Exception(detail if detail else 'Open WebUI: Server Connection Error')
|
||||
|
||||
|
||||
@@ -761,6 +767,9 @@ async def _transcribe_deepgram(request, file_path, languages, file_dir, id):
|
||||
|
||||
except Exception as e:
|
||||
log.exception(e)
|
||||
# LICENSE covers this Open WebUI error identifier.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
detail = 'Open WebUI: Server Connection Error'
|
||||
if r is not None:
|
||||
try:
|
||||
@@ -890,6 +899,9 @@ async def _transcribe_azure(request, file_path, filename, file_dir, id):
|
||||
detail = f'External: {res["error"].get("message", "")}'
|
||||
except Exception:
|
||||
detail = f'External: {e}'
|
||||
# LICENSE covers this Open WebUI error identifier.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
raise HTTPException(
|
||||
status_code=e.status if e.status else 500,
|
||||
detail=detail if detail else 'Open WebUI: Server Connection Error',
|
||||
@@ -1054,6 +1066,9 @@ async def _transcribe_mistral(request, file_path, filename, metadata, file_dir,
|
||||
detail = f'External: {await r.text()}'
|
||||
except Exception:
|
||||
detail = f'External: {e}'
|
||||
# LICENSE covers this Open WebUI error identifier.
|
||||
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
|
||||
# https://docs.openwebui.com/license.
|
||||
raise HTTPException(
|
||||
status_code=e.status if e.status else 500,
|
||||
detail=detail if detail else 'Open WebUI: Server Connection Error',
|
||||
|
||||
Reference in new issue
Block a user