Backend HTTP pour discuter avec les différentes IA (Harry Potter, Jurassic Park, Star Wars, etc.), en texte ou en vocal.
/api/chat/harry-potter/audio/api/chat/jurassic-park/audio/api/chat/lord-of-the-rings/audio/api/chat/star-wars/audio/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)"
}
curl -X POST http://localhost:8000/api/chat/harry-potter/audio \
-H "Content-Type: application/json" \
-d '{"question": "Présente-moi Poudlard"}'
/api/chat/harry-potter/voice/api/chat/jurassic-park/voice/api/chat/lord-of-the-rings/voice/api/chat/star-wars/voice/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"
}
curl -X POST http://localhost:8000/api/chat/harry-potter/voice \ -F "audio=@/chemin/vers/mon_fichier_audio.webm"
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());