refac/fix: stt supported type

This commit is contained in:
Timothy Jaeryang Baek
2025-06-18 14:01:14 +04:00
parent e79f31b9c4
commit 6186bbf337
2 changed files with 17 additions and 12 deletions
+8 -7
View File
@@ -155,17 +155,18 @@ def upload_file(
if process:
try:
if file.content_type:
stt_supported_content_types = (
request.app.state.config.STT_SUPPORTED_CONTENT_TYPES
or [
"audio/*",
"video/webm",
]
stt_supported_content_types = getattr(
request.app.state.config, "STT_SUPPORTED_CONTENT_TYPES", []
)
if any(
fnmatch(file.content_type, content_type)
for content_type in stt_supported_content_types
for content_type in (
stt_supported_content_types
if stt_supported_content_types
and any(t.strip() for t in stt_supported_content_types)
else ["audio/*", "video/webm"]
)
):
file_path = Storage.get_file(file_path)
result = transcribe(request, file_path, file_metadata)