Spaces:
Building
Building
Update admin_routes.py
Browse files- admin_routes.py +8 -19
admin_routes.py
CHANGED
@@ -1564,6 +1564,14 @@ async def generate_tts(
|
|
1564 |
cfg = ConfigProvider.get()
|
1565 |
api_key = cfg.global_config.get_tts_api_key()
|
1566 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1567 |
if not api_key:
|
1568 |
raise HTTPException(status_code=400, detail="TTS API key not configured")
|
1569 |
|
@@ -1583,25 +1591,6 @@ async def generate_tts(
|
|
1583 |
model_id=request.model_id,
|
1584 |
output_format=request.output_format
|
1585 |
)
|
1586 |
-
|
1587 |
-
# Return audio data
|
1588 |
-
from fastapi.responses import Response
|
1589 |
-
|
1590 |
-
content_type = "audio/mpeg" if request.output_format.startswith("mp3") else "audio/wav"
|
1591 |
-
|
1592 |
-
return Response(
|
1593 |
-
content=audio_data,
|
1594 |
-
media_type=content_type,
|
1595 |
-
headers={
|
1596 |
-
"Content-Disposition": f"attachment; filename=tts_output.{request.output_format.split('_')[0]}"
|
1597 |
-
}
|
1598 |
-
)
|
1599 |
-
|
1600 |
-
except HTTPException:
|
1601 |
-
raise
|
1602 |
-
except Exception as e:
|
1603 |
-
log(f"❌ TTS generation error: {e}")
|
1604 |
-
raise HTTPException(status_code=500, detail=str(e))
|
1605 |
|
1606 |
# ===================== Activity Log Endpoints =====================
|
1607 |
@router.get("/activity-log")
|
|
|
1564 |
cfg = ConfigProvider.get()
|
1565 |
api_key = cfg.global_config.get_tts_api_key()
|
1566 |
|
1567 |
+
# Debug log - API key'in ilk ve son karakterlerini göster
|
1568 |
+
if api_key:
|
1569 |
+
masked_key = f"{api_key[:4]}...{api_key[-4:]}" if len(api_key) > 8 else "***"
|
1570 |
+
log(f"🔑 TTS API Key (masked): {masked_key}")
|
1571 |
+
log(f"🔑 Key starts with 'enc:': {api_key.startswith('enc:')}")
|
1572 |
+
else:
|
1573 |
+
log("❌ TTS API key is None!")
|
1574 |
+
|
1575 |
if not api_key:
|
1576 |
raise HTTPException(status_code=400, detail="TTS API key not configured")
|
1577 |
|
|
|
1591 |
model_id=request.model_id,
|
1592 |
output_format=request.output_format
|
1593 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1594 |
|
1595 |
# ===================== Activity Log Endpoints =====================
|
1596 |
@router.get("/activity-log")
|