@@ -539,7 +539,6 @@ async def route_general_transcriptions(
539539 content = {"error" : f"Invalid request: missing '{ e .args [0 ]} ' in form data." },
540540 )
541541
542- logger .debug ("==== Enter audio_transcriptions ====" )
543542 logger .debug ("Received upload: %s (%s)" , file .filename , file .content_type )
544543 logger .debug (
545544 "Params: model=%s prompt=%r response_format=%r temperature=%r language=%s" ,
@@ -565,18 +564,16 @@ async def route_general_transcriptions(
565564
566565 endpoints = service_discovery .get_endpoint_info ()
567566
568- logger .debug ("==== Total endpoints ====" )
569- logger .debug (endpoints )
570- logger .debug ("==== Total endpoints ====" )
571-
572- # filter the endpoints url by model name and label for transcriptions
573- transcription_endpoints = [
574- ep
575- for ep in endpoints
576- if model == ep .model_name
577- and ep .model_label == "transcription"
578- and not ep .sleep # Added ep.sleep == False
579- ]
567+ # filter the endpoints url by model name and model_type for transcriptions
568+ transcription_endpoints = []
569+ for ep in endpoints :
570+ for model_name in ep .model_names :
571+ if (
572+ model == model_name
573+ and ep .model_type == "transcription"
574+ and not ep .sleep
575+ ):
576+ transcription_endpoints .append (ep )
580577
581578 logger .debug ("====List of transcription endpoints====" )
582579 logger .debug (transcription_endpoints )
@@ -620,10 +617,6 @@ async def route_general_transcriptions(
620617
621618 logger .info ("Proxying transcription request for model %s to %s" , model , chosen_url )
622619
623- logger .debug ("==== data payload keys ====" )
624- logger .debug (list (data .keys ()))
625- logger .debug ("==== data payload keys ====" )
626-
627620 try :
628621 client = request .app .state .aiohttp_client_wrapper ()
629622
@@ -687,3 +680,9 @@ async def route_general_transcriptions(
687680 status_code = 503 ,
688681 content = {"error" : f"Failed to connect to backend: { str (client_error )} " },
689682 )
683+ except Exception as e :
684+ logger .error (e )
685+ return JSONResponse (
686+ status_code = 500 ,
687+ content = {"error" : f"Internal server error" },
688+ )
0 commit comments