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.
This commit is contained in:
BlackAngelTV committed 2026-10-06 20:03:41 +02:00
1 parent 60984e70ec
commit 9226500a56
13 files changed
+1182 -37

No files matched your search

+8 -2
View File
@@ -19,8 +19,14 @@ service externe.
- **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, réponse lue à
voix haute.
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.