Files
Jarvise-project/README.md
T
BlackAngelTV 9226500a56 feat(frontend): render Markdown answers and speak them while they stream
Two things made Jarvis feel worse than it was. Its Markdown arrived as raw
syntax, because egui has no Markdown widget and the bundled fonts have a
single weight per family; the renderer therefore builds its own styled
LayoutJob, which keeps the bubble sizing already in place and tolerates a
half-streamed answer instead of printing markers. And the voice only started
once the whole answer was generated, so a long reply was read out after a
silence as long as the reply itself; the stream is now cut into sentences as
soon as their punctuation arrives, and the spoken text drops the Markdown and
the code blocks, since nobody wants asterisks and backticks read aloud.

The client also wakes the model on the first keystroke of a draft or when
recording starts, so the load happens while the sentence is still being
written, and it now sends a history the backend accepts: empty assistant
bubbles left by an abandoned answer are dropped, and only the last fifty
messages travel, which a long conversation used to overflow.
2026-10-06 20:03:41 +02:00

98 lines
4.4 KiB
Markdown

# Jarvise
Assistant IA **local** de type Jarvis : tout tourne sur la machine, rien ne part sur un
service externe.
| Composant | Rôle |
| --- | --- |
| [`backend/`](./backend) | API **Node.js / Fastify** + **SQLite** : auth JWT, projets, contextes, relais vers Ollama |
| [`frontend/`](./frontend) | Client **desktop Rust / egui** : chat en streaming, projets, **compagnon** (avatar), **voix locale** (STT + TTS) |
```
┌──────────────────────────┐ JSON / SSE ┌──────────────┐ JSON ┌────────┐
│ Client desktop (Rust) │ ───────────────────────▶ │ API Fastify │ ───────────────▶ │ Ollama │
│ egui · whisper.cpp ·Piper│ ◀─────────────────────── │ + SQLite │ ◀─────────────── │ (local)│
└──────────────────────────┘ réponse streamée └──────────────┘ NDJSON └────────┘
```
- **Texte** entre le client et l'API, **jamais d'audio**.
- **Projets** : une conversation = une mémoire persistante, rejouée vers le modèle à
chaque tour, avec plafond de taille et bouton de vérification.
- **Voix locale** : un appui sur le bouton micro lance l'enregistrement, un second
appui (`Ctrl+Espace` au clavier) l'arrête et lance la transcription. La réponse est lue
à voix haute **phrase par phrase, pendant qu'elle s'écrit**, et sans jamais prononcer la
syntaxe Markdown.
- **Réponses rendues** : le Markdown renvoyé par le modèle est mis en forme dans l'app
(titres, listes, tableaux, code, gras/italique) au lieu d'être affiché brut.
- **Démarrage à chaud** : le modèle Ollama est réveillé dès la première frappe ou le début
d'un enregistrement (`POST /api/chat/warm`) et maintenu en mémoire entre deux questions,
pour ne pas payer le chargement au moment de la réponse.
- **Deux modes** : un onglet **💬 Chat** (écrire) et un onglet **🗣️ Compagnon** (parler à
l'avatar centré) ; la transcription part vers le backend en **texte JSON**, jamais en audio.
## Documentation
| Document | Contenu |
| --- | --- |
| **[`docs/architecture.md`](./docs/architecture.md)** | Vue d'ensemble, flux, modèle de données, threading, décisions |
| **[`docs/api.md`](./docs/api.md)** | Contrat HTTP complet : routes, corps, réponses, SSE, erreurs |
| [`backend/README.md`](./backend/README.md) | Démarrage, configuration, dépannage |
| [`frontend/README.md`](./frontend/README.md) | Build, voix, tests, dépannage |
## Démarrage
### 1. Backend
```bash
cd backend
npm install
cp .env.example .env # renseigner JWT_SECRET
npm start # http://localhost:3000
curl http://localhost:3000/health
```
Le modèle par défaut (`llama3.2`) doit être téléchargé : `ollama pull llama3.5 2>/dev/null || ollama pull llama3.2`.
### 2. Client desktop
```bash
cd frontend
cargo run # ou cargo build --release
```
Sans configuration, le client vise `http://localhost:3000` (modifiable dans l'écran de
connexion) et le modèle `qwen2.5:3b` (champ « Modèle » de la barre du haut).
### 3. Se connecter
Créer un compte :
```bash
curl -X POST http://localhost:3000/api/auth/register \
-H 'Content-Type: application/json' \
-d '{"email":"tony@stark.com","password":"motdepasse123","name":"Tony"}'
```
Puis saisir ces identifiants dans le client. Le jeton est mis en cache par l'application.
## Tests
```bash
cd backend && npm test # 34 tests : routes, SSE, rétention, sonde de contexte
cd frontend && cargo test # 28 tests : contrats SSE, projets, mise en page, compagnon
```
Le build Rust exige `libclang` (dépendance de Piper) — voir
[`frontend/README.md`](./frontend/README.md#prérequis).
## Répartition des rôles
- **L'API** est la seule à écrire en base : elle rejoue le contexte, persiste les
échanges, purge au-delà de `MAX_PROJECT_MESSAGES`, et sait dire si Ollama a bien reçu
l'historique.
- **Le client** ne fait que visualiser et capturer : il garde le jeton, l'historique
affiché, et la voix — mais aucune vérité sur l'état d'une conversation.
## Licence
Voir [`LICENSE`](./LICENSE).