# Chatbot Darija
Chatbot Darija est une application mobile basee sur Expo/React Native avec un backend FastAPI.
Le produit permet de discuter en darija marocaine en texte et en vocal, avec authentification utilisateur et historique des conversations.
## Vue d'ensemble
- Application mobile: React Native + Expo (TypeScript)
- API backend: FastAPI (Python)
- Base de donnees: SQLite via SQLAlchemy
- Authentification: JWT + verification email
- IA conversationnelle: Google Gemini
- Voix:
- STT: SpeechRecognition (ar-MA)
- TTS: Edge TTS (avec fallback gTTS)
## Fonctionnalites
- Inscription, verification email, connexion
- Conversation texte en darija
- Message vocal utilisateur (STT)
- Reponse bot en texte et audio (TTS)
- Historique des conversations
- Interface AR/FR avec theme clair/sombre
## Architecture
```text
chatbot_darija/
chatbot_darija_backend/
app/
auth_api/
data/
static/
api.py
chatbot.py
conversation_service.py
database.py
main.py
models.py
nlp_model.py
tts_stt.py
.env.example
README.md
requirements.txt
reset_users.py
test.py
frontend/
assets/
components/
config/
contexts/
screens/
App.tsx
app.json
index.ts
package.json
theme.ts
tsconfig.json
```
## Role des fichiers
### Backend (`chatbot_darija_backend`)
- `app/main.py`: point d'entree FastAPI, middleware CORS, montage des fichiers statiques, initialisation des tables.
- `app/api.py`: routes principales chat, voix, conversations; agregation des routes auth.
- `app/chatbot.py`: orchestration Gemini, prompt systeme, normalisation de reponse, gestion de l'historique court.
- `app/conversation_service.py`: logique metier conversations/messages (create, list, update, soft delete, recent messages).
- `app/database.py`: configuration SQLAlchemy (engine, session, helpers).
- `app/models.py`: modeles ORM (User, Conversation, Message).
- `app/tts_stt.py`: transcription audio (STT), synthese vocale (TTS), gestion des conversions audio.
- `app/nlp_model.py`: composant NLP present dans le projet.
- `app/auth_ …