Spaces:
Running
Running
Update admin_routes.py
Browse files- admin_routes.py +16 -3
admin_routes.py
CHANGED
@@ -433,7 +433,17 @@ async def get_environment(username: str = Depends(verify_token)):
|
|
433 |
"tts_engine": env_config.get("tts_engine", "no_tts"),
|
434 |
"tts_engine_api_key": env_config.get("tts_engine_api_key", ""),
|
435 |
"stt_engine": env_config.get("stt_engine", "no_stt"),
|
436 |
-
"stt_engine_api_key": env_config.get("stt_engine_api_key", "")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
}
|
438 |
|
439 |
|
@@ -463,14 +473,14 @@ async def update_environment(
|
|
463 |
if update.tts_engine not in ("no_tts", "elevenlabs", "blaze"):
|
464 |
raise HTTPException(status_code=400, detail="Invalid TTS engine")
|
465 |
|
466 |
-
if update.stt_engine not in ("no_stt", "
|
467 |
raise HTTPException(status_code=400, detail="Invalid STT engine")
|
468 |
|
469 |
if update.tts_engine != "no_tts" and not update.tts_engine_api_key:
|
470 |
raise HTTPException(status_code=400, detail=f"{update.tts_engine} API key is required")
|
471 |
|
472 |
if update.stt_engine != "no_stt" and not update.stt_engine_api_key:
|
473 |
-
raise HTTPException(status_code=400, detail=f"{update.stt_engine} API key
|
474 |
|
475 |
# Spark endpoint validation
|
476 |
if update.work_mode not in ("gpt4o", "gpt4o-mini") and not update.spark_endpoint:
|
@@ -487,6 +497,9 @@ async def update_environment(
|
|
487 |
encrypted_tts_key = ""
|
488 |
log("⚠️ No TTS key to encrypt")
|
489 |
|
|
|
|
|
|
|
490 |
# Update config
|
491 |
config["config"]["work_mode"] = update.work_mode
|
492 |
config["config"]["cloud_token"] = update.cloud_token or ""
|
|
|
433 |
"tts_engine": env_config.get("tts_engine", "no_tts"),
|
434 |
"tts_engine_api_key": env_config.get("tts_engine_api_key", ""),
|
435 |
"stt_engine": env_config.get("stt_engine", "no_stt"),
|
436 |
+
"stt_engine_api_key": env_config.get("stt_engine_api_key", ""),
|
437 |
+
"stt_settings": env_config.get("stt_settings", {
|
438 |
+
"speech_timeout_ms": 2000,
|
439 |
+
"noise_reduction_level": 2,
|
440 |
+
"vad_sensitivity": 0.5,
|
441 |
+
"language": "tr-TR",
|
442 |
+
"model": "latest_long",
|
443 |
+
"use_enhanced": True,
|
444 |
+
"enable_punctuation": True,
|
445 |
+
"interim_results": True
|
446 |
+
})
|
447 |
}
|
448 |
|
449 |
|
|
|
473 |
if update.tts_engine not in ("no_tts", "elevenlabs", "blaze"):
|
474 |
raise HTTPException(status_code=400, detail="Invalid TTS engine")
|
475 |
|
476 |
+
if update.stt_engine not in ("no_stt", "google", "azure", "amazon", "gpt4o_realtime", "flicker"):
|
477 |
raise HTTPException(status_code=400, detail="Invalid STT engine")
|
478 |
|
479 |
if update.tts_engine != "no_tts" and not update.tts_engine_api_key:
|
480 |
raise HTTPException(status_code=400, detail=f"{update.tts_engine} API key is required")
|
481 |
|
482 |
if update.stt_engine != "no_stt" and not update.stt_engine_api_key:
|
483 |
+
raise HTTPException(status_code=400, detail=f"{update.stt_engine} API key or credentials required")
|
484 |
|
485 |
# Spark endpoint validation
|
486 |
if update.work_mode not in ("gpt4o", "gpt4o-mini") and not update.spark_endpoint:
|
|
|
497 |
encrypted_tts_key = ""
|
498 |
log("⚠️ No TTS key to encrypt")
|
499 |
|
500 |
+
if update.stt_settings:
|
501 |
+
config["config"]["stt_settings"] = update.stt_settings
|
502 |
+
|
503 |
# Update config
|
504 |
config["config"]["work_mode"] = update.work_mode
|
505 |
config["config"]["cloud_token"] = update.cloud_token or ""
|