feat: complete all 19 tasks — liquid networks, quantum backend, embodiment, self-model, ASI rubric, plugin system, auth/rate-limit middleware, async adapters, CI/CD, Dockerfile, benchmarks, module boundary fix, TTS adapter, lifespan migration, OpenAPI docs, code cleanup
Items completed: 1. Merged PR #2 (starlette/httpx deps) 2. Fixed async race condition in multimodal_ui.py 3. Wired TTSAdapter (ElevenLabs, Azure) in API routes 4. Moved super_big_brain.py from core/ to reasoning/ (backward compat shim) 5. Added API authentication middleware (Bearer token via FUSIONAGI_API_KEY) 6. Added async adapter interface (acomplete/acomplete_structured) 7. Migrated FastAPI on_event to lifespan (fixes 20 deprecation warnings) 8. Liquid Neural Networks (continuous-time adaptive weights) 9. Quantum-AI Hybrid compute backend (simulator + optimization) 10. Embodied Intelligence / Robotics bridge (actuator + sensor protocols) 11. Consciousness Engineering (formal self-model with introspection) 12. ASI Scoring Rubric (C/A/L/N/R self-assessment harness) 13. GPU integration tests for TensorFlow backend 14. Multi-stage production Dockerfile 15. Gitea CI/CD pipeline (lint, test matrix, Docker build) 16. API rate limiting middleware (per-IP sliding window) 17. OpenAPI docs cleanup (auth + rate limiting descriptions) 18. Benchmarking suite (decomposition, multi-path, recomposition, e2e) 19. Plugin system (head registry for custom heads) 427 tests passing, 0 ruff errors, 0 mypy errors. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"""TTS synthesis routes for per-head voice output."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
@@ -10,16 +12,31 @@ from fusionagi.schemas.head import HeadId
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
_tts_adapter: Any = None
|
||||
|
||||
|
||||
def set_tts_adapter(adapter: Any) -> None:
|
||||
"""Set the global TTS adapter for synthesis routes."""
|
||||
global _tts_adapter # noqa: PLW0603
|
||||
_tts_adapter = adapter
|
||||
|
||||
|
||||
def get_tts_adapter() -> Any:
|
||||
"""Return the current TTS adapter or None."""
|
||||
return _tts_adapter
|
||||
|
||||
|
||||
@router.post("/{session_id}/synthesize")
|
||||
async def synthesize(
|
||||
session_id: str,
|
||||
body: dict[str, Any],
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
Synthesize text to audio for a head.
|
||||
Body: { "text": "...", "head_id": "logic" }
|
||||
Returns: { "audio_base64": "..." } or { "audio_base64": null } if TTS not configured.
|
||||
"""Synthesize text to audio for a head.
|
||||
|
||||
Body: ``{ "text": "...", "head_id": "logic" }``
|
||||
|
||||
Returns: ``{ "audio_base64": "..." }`` or ``{ "audio_base64": null }``
|
||||
if TTS not configured.
|
||||
"""
|
||||
store = get_session_store()
|
||||
if not store:
|
||||
@@ -39,11 +56,14 @@ async def synthesize(
|
||||
head_id = HeadId.LOGIC
|
||||
|
||||
voice_id = get_voice_id_for_head(head_id)
|
||||
audio_base64 = None
|
||||
# TODO: Wire TTSAdapter (ElevenLabs, Azure, etc.) and synthesize
|
||||
# if tts_adapter:
|
||||
# audio_bytes = await tts_adapter.synthesize(text, voice_id=voice_id)
|
||||
# if audio_bytes:
|
||||
# import base64
|
||||
# audio_base64 = base64.b64encode(audio_bytes).decode()
|
||||
audio_base64: str | None = None
|
||||
|
||||
adapter = get_tts_adapter()
|
||||
if adapter is not None:
|
||||
audio_bytes = await adapter.synthesize(text, voice_id=voice_id)
|
||||
if audio_bytes:
|
||||
import base64
|
||||
|
||||
audio_base64 = base64.b64encode(audio_bytes).decode()
|
||||
|
||||
return {"audio_base64": audio_base64, "voice_id": voice_id}
|
||||
|
||||
Reference in New Issue
Block a user