mirror of
https://github.com/zebrajr/ollama-webui.git
synced 2026-01-15 12:15:13 +00:00
fix/refac: stt default content type
This commit is contained in:
@@ -1151,10 +1151,9 @@ def transcription(
|
||||
user=Depends(get_verified_user),
|
||||
):
|
||||
log.info(f"file.content_type: {file.content_type}")
|
||||
|
||||
stt_supported_content_types = getattr(
|
||||
request.app.state.config, "STT_SUPPORTED_CONTENT_TYPES", []
|
||||
) or ["audio/*", "video/webm"]
|
||||
)
|
||||
|
||||
if not strict_match_mime_type(stt_supported_content_types, file.content_type):
|
||||
raise HTTPException(
|
||||
|
||||
@@ -114,7 +114,7 @@ def process_uploaded_file(request, file, file_path, file_item, file_metadata, us
|
||||
if file.content_type:
|
||||
stt_supported_content_types = getattr(
|
||||
request.app.state.config, "STT_SUPPORTED_CONTENT_TYPES", []
|
||||
) or ["audio/*", "video/webm"]
|
||||
)
|
||||
|
||||
if strict_match_mime_type(stt_supported_content_types, file.content_type):
|
||||
file_path = Storage.get_file(file_path)
|
||||
|
||||
@@ -622,6 +622,10 @@ def strict_match_mime_type(supported: list[str] | str, header: str) -> Optional[
|
||||
|
||||
supported = [s for s in supported if s.strip() and "/" in s]
|
||||
|
||||
if len(supported) == 0:
|
||||
# Default to common types if none are specified
|
||||
supported = ["audio/*", "video/webm"]
|
||||
|
||||
match = mimeparse.best_match(supported, header)
|
||||
if not match:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user