API Cinema 3D

Backend HTTP pour discuter avec les différentes IA (Harry Potter, Jurassic Park, Star Wars, etc.), en texte ou en vocal.

Endpoints disponibles

1. Chat texte + réponse audio

POST/api/chat/harry-potter/audio
POST/api/chat/jurassic-park/audio
POST/api/chat/lord-of-the-rings/audio
POST/api/chat/star-wars/audio
POST/api/chat/stranger-things/audio

JSON Corps de requête :

{
  "question": "Ta question en texte"
}

Réponse JSON :

{
  "answer": "Réponse de l'IA",
  "audio": "BASE64_MP3",
  "audioError": "Message d'erreur Murf éventuel (optionnel)"
}

Exemple cURL (Harry Potter)

curl -X POST http://localhost:8000/api/chat/harry-potter/audio \
  -H "Content-Type: application/json" \
  -d '{"question": "Présente-moi Poudlard"}'

2. Chat vocal (AssemblyAI + Monica + Murf)

POSTmultipart/form-data /api/chat/harry-potter/voice
POST/api/chat/jurassic-park/voice
POST/api/chat/lord-of-the-rings/voice
POST/api/chat/star-wars/voice
POST/api/chat/stranger-things/voice

Corps de requête : formulaire multipart/form-data avec un champ fichier nommé audio (webm, mp3, wav...)

Réponse JSON :

{
  "answer": "Texte généré par l'IA",
  "audio": "BASE64_MP3",
  "audioError": "Message d'erreur Murf éventuel (optionnel)",
  "error": "Message d'erreur global éventuel"
}

Exemple cURL (Harry Potter, vocal)

curl -X POST http://localhost:8000/api/chat/harry-potter/voice \
  -F "audio=@/chemin/vers/mon_fichier_audio.webm"

Intégration front (React, par exemple)

Pour le texte :

fetch('/api/chat/star-wars/audio', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ question: 'Parle-moi de la Force' })
}).then(r => r.json());

Pour le vocal :

const formData = new FormData();
formData.append('audio', file); // File ou Blob audio

fetch('/api/chat/star-wars/voice', {
  method: 'POST',
  body: formData
}).then(r => r.json());