From 886ecbb433aaf4a2b319f2bf1c833c7101f75c5b Mon Sep 17 00:00:00 2001 From: Hermann_Kitio Date: Tue, 21 Apr 2026 03:24:39 +0300 Subject: [PATCH] =?UTF-8?q?docs(changelog):=20t=C3=A2che=20G5=20=E2=80=94?= =?UTF-8?q?=20suggestions=20d'id=C3=A9es=20DeepSeek?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 (1M context) --- docs/CHANGELOG.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6904dd0..7508030 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -37,6 +37,49 @@ Chaque entrée suit ce format : - Code source de `src/entities/user/access.ts` et `lib.ts` avec tests +## 2026-04-21 — Tâche G5 — Suggestions d'idées DeepSeek + +### Ajouté +- **Backend** — `POST /sujets/idees` : génère 5 suggestions + d'idées via DeepSeek pour aider l'étudiant à prolonger sa + rédaction (prompt coach TCF Canada, temperature 0.5, + timeout 15 s via AbortSignal, JSON strict + `{ idees: string[] }`) +- `generateIdees(consigne, contenu)` dans `src/lib/deepseek.ts` + (validation tableau non vide) +- 5 tests route `POST /sujets/idees` : 401 sans auth, + 400 sujet_consigne manquant, 400 contenu < 30 mots, + 200 succès avec idees[], 500 DeepSeek throw +- **Frontend** — `getIdees(consigne, contenu)` dans + `entities/report/api.ts` (POST `/sujets/idees`, + timeoutMs 15 000) +- Hook `useIdees` — `useMutation` exposant + `{ idees, isLoading, error, fetchIdees, reset }` +- Composant `IdeesSuggestions` — modal shadcn Dialog avec + liste à puces, états loading/erreur/succès, + `reset()` automatique à la fermeture +- Bouton "Suggestions d'idées" (icône Lightbulb) dans + `SimulationForm` à côté de "Changer de sujet" +- Prop `plan: Plan` ajouté à `SimulationForm` (wiring + `planData.plan` depuis `SimulationPage`) + +### Règles d'accès +- Règle D respectée : `hasAccess(plan, 'tips')` obligatoire +- Plan Free : bouton visible mais désactivé avec tooltip + "Disponible en Standard" (tips=false pour Free) +- Standard + Premium : bouton actif dès 30 mots écrits +- Désactivé également si `!sujet`, `isSubmitting`, ou + `idees.isLoading` + +### Tests +- Backend — Typecheck : 0 erreur, Vitest : 144/144 passés + (+5 tests POST /sujets/idees) +- Frontend — Typecheck : 0 erreur, Vitest : 67/67 passés +- Test manuel : validé avec compte Standard (bouton actif + à 30+ mots, modal affiche 5 idées) et Free (bouton + verrouillé avec tooltip) + + ## 2026-04-21 — Tâche G4 + Refonte page /sujets + Fix quota simulations ### Ajouté