mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-29 02:46:25 +02:00
refactor: eliminate duplicated STT service condition check
- Compute stt_service_type once and reuse - Follow DRY principles - Improve code maintainability
This commit is contained in:
parent
cf0e265107
commit
504399ad01
1 changed files with 4 additions and 2 deletions
|
|
@ -784,8 +784,11 @@ async def process_file_in_background(
|
|||
{"file_type": "audio", "processing_stage": "starting_transcription"},
|
||||
)
|
||||
|
||||
# Determine STT service type
|
||||
stt_service_type = "local" if app_config.STT_SERVICE and app_config.STT_SERVICE.startswith("local/") else "external"
|
||||
|
||||
# Check if using local STT service
|
||||
if app_config.STT_SERVICE and app_config.STT_SERVICE.startswith("local/"):
|
||||
if stt_service_type == "local":
|
||||
# Use local Faster-Whisper for transcription
|
||||
from app.services.stt_service import stt_service
|
||||
|
||||
|
|
@ -849,7 +852,6 @@ async def process_file_in_background(
|
|||
)
|
||||
|
||||
if result:
|
||||
stt_service_type = "local" if app_config.STT_SERVICE and app_config.STT_SERVICE.startswith("local/") else "external"
|
||||
await task_logger.log_task_success(
|
||||
log_entry,
|
||||
f"Successfully transcribed and processed audio file: {filename}",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue