Initial PWA assistant proof of concept
This commit is contained in:
125
README.md
Normal file
125
README.md
Normal file
@@ -0,0 +1,125 @@
|
||||
# OpenSquared Assistant PWA
|
||||
|
||||
POC de PWA mobile pour parler a l'assistant depuis un telephone.
|
||||
|
||||
## Fonctionnalites
|
||||
|
||||
- Interface mobile installable sur Android via "Ajouter a l'ecran d'accueil".
|
||||
- Bouton micro avec transcription Groq Whisper.
|
||||
- Reponse LLM Groq.
|
||||
- Lecture audio automatique de la reponse apres interaction utilisateur.
|
||||
- Envoi d'emails Gmail avec carnet de contacts `contacts.json`.
|
||||
|
||||
## Configuration locale
|
||||
|
||||
```powershell
|
||||
cd pwa_assistant
|
||||
copy .env.example .env
|
||||
```
|
||||
|
||||
Remplir `.env` :
|
||||
|
||||
```text
|
||||
GROQ_API_KEY=...
|
||||
GMAIL_EMAIL=...
|
||||
GMAIL_PASSWORD=...
|
||||
APP_SECRET=...
|
||||
```
|
||||
|
||||
Installer :
|
||||
|
||||
```powershell
|
||||
C:\Users\baron\AppData\Local\Programs\Python\Python313\python.exe -m pip install -r requirements.txt
|
||||
```
|
||||
|
||||
Lancer :
|
||||
|
||||
```powershell
|
||||
C:\Users\baron\AppData\Local\Programs\Python\Python313\python.exe app.py
|
||||
```
|
||||
|
||||
Puis ouvrir :
|
||||
|
||||
```text
|
||||
http://localhost:8080
|
||||
```
|
||||
|
||||
Sur telephone, le micro necessite HTTPS sauf cas particulier localhost.
|
||||
|
||||
## Deploiement VPS Hostinger
|
||||
|
||||
Exemple Ubuntu :
|
||||
|
||||
```bash
|
||||
cd /var/www
|
||||
git clone <ton-repo-ou-upload> opensquared-assistant
|
||||
cd opensquared-assistant/pwa_assistant
|
||||
python3 -m venv .venv
|
||||
. .venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
cp .env.example .env
|
||||
nano .env
|
||||
```
|
||||
|
||||
Service systemd :
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=OpenSquared Assistant PWA
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/var/www/opensquared-assistant/pwa_assistant
|
||||
EnvironmentFile=/var/www/opensquared-assistant/pwa_assistant/.env
|
||||
ExecStart=/var/www/opensquared-assistant/pwa_assistant/.venv/bin/gunicorn -w 2 -b 127.0.0.1:8080 app:app
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
Commandes :
|
||||
|
||||
```bash
|
||||
sudo nano /etc/systemd/system/opensquared-assistant.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now opensquared-assistant
|
||||
sudo systemctl status opensquared-assistant
|
||||
```
|
||||
|
||||
Nginx :
|
||||
|
||||
```nginx
|
||||
server {
|
||||
server_name assistant.ton-domaine.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
HTTPS avec Certbot :
|
||||
|
||||
```bash
|
||||
sudo certbot --nginx -d assistant.ton-domaine.com
|
||||
```
|
||||
|
||||
## Installation Android
|
||||
|
||||
1. Ouvrir l'URL HTTPS dans Chrome Android.
|
||||
2. Menu `...`.
|
||||
3. `Ajouter a l'ecran d'accueil` ou `Installer l'application`.
|
||||
4. Ouvrir l'icone `Assistant`.
|
||||
5. Appuyer une fois sur `Demarrer` pour autoriser micro/audio.
|
||||
|
||||
## Notes
|
||||
|
||||
- Groq Orpheus TTS doit etre accepte dans la console Groq pour fonctionner :
|
||||
https://console.groq.com/playground?model=canopylabs%2Forpheus-v1-english
|
||||
- La lecture audio automatique depend toujours des regles du navigateur mobile, mais elle marche mieux dans une PWA apres un tap utilisateur que dans Telegram.
|
||||
Reference in New Issue
Block a user