This commit is contained in:
Timothy Jaeryang Baek
2026-07-27 19:39:36 -04:00
parent b6b16d5871
commit 810378c0b8
93 changed files with 440 additions and 12 deletions
+15
View File
@@ -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',
+6
View File
@@ -1809,6 +1809,9 @@ async def get_webhook_profile_image(webhook_id: str, user=Depends(get_verified_u
webhook = await Channels.get_webhook_by_id(webhook_id)
if not webhook:
# Return default favicon if webhook not found
# LICENSE covers this Open WebUI fallback logo.
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
# https://docs.openwebui.com/license.
return FileResponse(f'{STATIC_DIR}/favicon.png')
if webhook.profile_image_url:
@@ -1834,6 +1837,9 @@ async def get_webhook_profile_image(webhook_id: str, user=Depends(get_verified_u
pass
# Return default favicon if no profile image
# LICENSE covers this Open WebUI fallback logo.
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
# https://docs.openwebui.com/license.
return FileResponse(f'{STATIC_DIR}/favicon.png')
+6
View File
@@ -609,6 +609,9 @@ async def get_model_profile_image(
# only serve known-safe raster types inline; reject SVG/unknown (can run script on our origin)
if media_type not in PROFILE_IMAGE_ALLOWED_MIME_TYPES:
# LICENSE covers this Open WebUI fallback logo.
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
# https://docs.openwebui.com/license.
return RedirectResponse(
url='/static/favicon.png',
status_code=status.HTTP_302_FOUND,
@@ -636,6 +639,9 @@ async def get_model_profile_image(
status_code=status.HTTP_302_FOUND,
)
# LICENSE covers this Open WebUI fallback logo.
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
# https://docs.openwebui.com/license.
return RedirectResponse(
url='/static/favicon.png',
status_code=status.HTTP_302_FOUND,
@@ -94,6 +94,9 @@ async def set_default_notification_target(target_id: str, user=Depends(get_verif
async def test_notification_target(request: Request, target_id: str, user=Depends(get_verified_user)):
await _check_notifications_access(user)
try:
# LICENSE covers this Open WebUI notification identifier.
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
# https://docs.openwebui.com/license.
app_name = getattr(request.app.state, 'WEBUI_NAME', 'Open WebUI')
return await test_target(user.id, target_id, app_name)
except ValueError as e:
+12
View File
@@ -166,6 +166,9 @@ async def get_headers_and_cookies(
'Content-Type': 'application/json',
**(
{
# LICENSE covers this Open WebUI upstream metadata identifier.
# Do not alter, remove, obscure, or replace it except as LICENSE permits:
# https://docs.openwebui.com/license.
'HTTP-Referer': 'https://openwebui.com/',
'X-Title': 'Open WebUI',
}
@@ -516,6 +519,9 @@ async def speech(request: Request, user=Depends(get_verified_user)):
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=r.status if r else 500,
detail=detail if detail else 'Open WebUI: Server Connection Error',
@@ -773,6 +779,9 @@ async def get_models(request: Request, url_idx: int | None = None, user=Depends(
except aiohttp.ClientError as e:
# ClientError covers all aiohttp requests issues
log.exception(f'Client error: {str(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=500, detail='Open WebUI: Server Connection Error')
except Exception as e:
log.exception(f'Unexpected error: {e}')
@@ -1784,6 +1793,9 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
raise
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.
raise HTTPException(
status_code=r.status if r else 500,
detail='Open WebUI: Server Connection Error',