Repository navigation
Conversation
…n by Google Google shut down `gemini-2.0-flash` on 1 June 2026 (Gemini API deprecations page, read on 9 November 2026). Unless VITE_AI_TUTOR_GEMINI_MODEL overrides it, the tutor's Gemini option now gets a 404 (`model_unavailable`) on every question. - Default model: `gemini-3.6-flash`, the replacement Google recommends for gemini-2.0-flash; stable, no shutdown date announced. `gemini-2.5-flash` was not taken: it is deprecated too and reroutes on 1 December 2026. - Same behaviour as before: Gemini 3 models think by default (medium) and thinking tokens count against maxOutputTokens, so with our 1024-token cap answers could come back cut or empty. The request now sets `thinkingConfig.thinkingLevel: MINIMAL`, only for Gemini 3 and later: older models reject the field, and a deploy may still point the env override at a 2.5 model. - Label "Gemini 3.6 Flash" added so the drawer shows the model by name. Tests: default model, thinkingConfig sent to Gemini 3+, absent for 2.5, model-id detection. No live call (BYOK, no Gemini key on this machine).
…3.5 Flash-Lite by default
- New `modelChoices.ts` extends `resolveModel`: learner choice (localStorage
`ai_tutor_model_<provider>`, flushed at signout) > env override if offered
> code default. Stale stored values or overrides (gemini-2.0-flash,
gemini-2.5-*, claude-sonnet-4-6) fall back to the default.
- Paramètres IA: radio group per provider (OpenRouter, Anthropic, Gemini)
with name + French cost hint; OpenAI keeps the read-only model line.
- Defaults: OpenRouter anthropic/claude-sonnet-5.5 (Opus 5.5 offered),
Anthropic claude-sonnet-5-5 (claude-opus-5-5 offered), Gemini
gemini-3.5-flash-lite (gemini-3.6-flash offered).
- Gemini: thinkingLevel MINIMAL only for models documented with `minimal`.
Anthropic: thinking between_tools on Sonnet 5.5; Opus 5.5 (always on)
gets a 4096 output cap.
Sources checked 2026-11-09: ai.google.dev/gemini-api/docs/{models,pricing,thinking},
platform.claude.com/docs/en/about-claude/models/overview, .../build-with-claude/effort,
GET openrouter.ai/api/v1/models.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Guide du réviseurStructures de donnéesDéfinir les listes fermées de modèles disponibles par fournisseur et les fonctions de stockage qui déterminent quels choix des apprenants sont valides.
Ajouter la clé de stockage local pour les choix de modèles et inclure ces choix dans le nettoyage des sessions d’IA.
APIMettre à jour les contrats de requête des fournisseurs pour tenir compte des nouvelles valeurs par défaut ainsi que des paramètres propres à chaque fournisseur pour le raisonnement et les jetons de sortie.
Exposer les fonctions utilitaires de choix de modèle et déterminer le modèle effectif en privilégiant le choix de l’apprenant, puis une surcharge de déploiement valide, et enfin le modèle par défaut du fournisseur.
Utilisations de l’APIUtiliser le hook partagé de résolution du modèle dans le panneau du tuteur afin que le modèle affiché et celui demandé tiennent compte des choix faits dans les paramètres ou dans un autre onglet.
Effacer l’état d’IA côté client dès que Supabase signale une déconnexion, y compris celles lancées ailleurs ou provoquées par l’expiration de la session.
ImplémentationS’abonner aux changements du stockage des choix de modèles et fournir un hook permettant aux consommateurs de lire le modèle résolu actuel.
Interface utilisateurAfficher le modèle actif de chaque fournisseur, ajouter des groupes de boutons radio accessibles pour le choix du modèle et des indications de coût, et expliquer pourquoi un modèle sélectionné ne peut pas être enregistré.
ConfigurationDocumenter les surcharges de modèle de déploiement acceptées pour les fournisseurs proposant un sélecteur, tout en conservant les surcharges OpenAI sans restriction.
DocumentationConsigner dans le journal des modifications le retrait du modèle, les modèles de remplacement par défaut, les choix des apprenants, les coûts et le comportement de raisonnement.
Ajouter le récit du retrait du modèle et mettre à jour la date de dernière modification.
Mettre à jour l’état de la feuille de route pour refléter la livraison du sélecteur de modèles du tuteur IA.
Modifier l’ADR-009 pour expliquer pourquoi tous les rôles partagent les mêmes choix de modèles par fournisseur, tandis que l’isolation des rôles reste fondée sur les invites.
Mettre à jour le dernier état du plan en français pour y mentionner cette livraison du tuteur IA.
TestsVérifier les modèles par défaut et les paramètres de raisonnement des fournisseurs, la priorité de résolution des modèles, le nettoyage des valeurs obsolètes et les libellés des choix de modèles.
Tester l’affichage et la synchronisation du modèle dans le panneau du tuteur, y compris lorsqu’un choix est modifié dans un autre onglet.
Tester le choix du modèle dans les paramètres, sa persistance, son accessibilité, le blocage du stockage, les mises à jour entre onglets et l’affichage en lecture seule du modèle OpenAI.
Vérifier que le nettoyage de session supprime les choix de modèles stockés et que les déconnexions signalées par l’écouteur d’authentification déclenchent le nettoyage côté client.
Conseils et commandesInteragir avec Sourcery
Personnaliser votre expérienceAccédez à votre tableau de bord pour :
Obtenir de l’aide
Original review guide in EnglishReviewer's GuideData structuresDefine the closed per-provider model-choice lists and storage helpers that determine which learner selections are valid.
Add the local-storage key for model choices and include those choices in AI session cleanup.
APIUpdate provider request contracts for the new defaults and their provider-specific thinking and output-token settings.
Expose model-choice helpers and resolve the effective model using learner choice, valid deployment override, then provider default.
Uses of the APIUse the shared resolved-model hook in the tutor panel so its displayed and requested model follows choices made in Settings or another tab.
Clear client-side AI state whenever Supabase reports sign-out, including sign-outs initiated elsewhere or caused by session expiry.
ImplementationSubscribe to model-choice storage changes and provide a hook for consumers to read the current resolved model.
UIShow each provider’s active model, add accessible model radio groups and cost hints, and explain when a selected model cannot be saved.
ConfigurationDocument which deployment model overrides are accepted for picker providers and retain unrestricted OpenAI overrides.
DocumentationRecord the model retirement, replacement defaults, learner choices, costs, and reasoning behavior in the changelog.
Add the model-retirement story and update the last-updated date.
Update the roadmap status with the AI tutor model-picker delivery.
Amend ADR-009 to explain why all roles share the same provider model choices while role isolation remains prompt-based.
Update the French plan’s latest status with this AI tutor delivery.
TestsVerify provider defaults and thinking settings, model resolution precedence and stale-value cleanup, and model-choice labels.
Cover tutor-panel model display and synchronization, including a choice changed in another tab.
Test Settings model selection, persistence, accessibility, blocked storage, cross-tab updates, and OpenAI’s read-only model display.
Verify session cleanup removes stored model choices and auth-listener sign-outs trigger client teardown.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Bonjour — j’ai trouvé 10 problèmes
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/lib/ai/keyManager.ts" line_range="305" />
<code_context>
- for (const p of PROVIDERS) ls.removeItem(LS_PREFIX + p);
+ for (const p of PROVIDERS) {
+ ls.removeItem(LS_PREFIX + p);
+ ls.removeItem(MODEL_KEY_PREFIX + p);
+ }
ls.removeItem(PROVIDER_KEY);
</code_context>
<issue_to_address>
**Next learner inherits model choice**
When a Supabase `SIGNED_OUT` event reaches this tab without going through this context’s explicit `signOut` function, `AuthContext` only updates the session in its auth-state listener and does not call `clearAiSessionData`, so the previous learner’s model choice remains in localStorage and `resolveModel` applies it to the next learner.
Run the client-state teardown when the auth-state listener receives `SIGNED_OUT`, not only in the explicit sign-out method.
</issue_to_address>
### Comment 2
<location path="src/lib/ai/providers/modelChoices.ts" line_range="42-52" />
<code_context>
+
+export const MODEL_CHOICES: Readonly<Partial<Record<Provider, readonly ModelChoice[]>>> = {
+ // Sonnet 5.5: $2 / $10 per million tokens; Opus 5.5: $4 / $20.
+ openrouter: [
+ {
+ id: OPENROUTER_DEFAULT_MODEL,
+ label: 'Claude Sonnet 5.5',
+ hint: 'Rapide et précis · choix par défaut',
+ },
+ {
+ id: 'anthropic/claude-opus-5.5',
</code_context>
<issue_to_address>
**OpenRouter Opus answers get cut**
When a learner selects Claude Opus 5.5 for OpenRouter, selecting Claude Opus 5.5 through OpenRouter sends it through the OpenRouter adapter, while the new larger output cap is applied only by the Anthropic adapter. Because Opus thinking consumes output tokens, the OpenRouter request can leave too little of its 1024-token budget for the answer, so students receive cut or empty replies.
Apply the required thinking and output-budget settings to OpenRouter requests for these Claude models, or do not offer Opus there until the adapter supports them.
</issue_to_address>
### Comment 3
<location path="src/app/components/ai/AiTutorPanel.tsx" line_range="112" />
<code_context>
+ // the choice can change on the Settings page while this panel stays
+ // mounted, and opening the panel re-renders it, which re-reads the choice
+ // (one localStorage read).
+ const model = resolveModel(provider);
// THI-148 V1.0.1 — static, public-only platform overview injected as
</code_context>
<issue_to_address>
**Tutor uses the previous model**
When the tutor panel stays mounted while the model changes in Settings in another tab, `AiTutorPanel` calls `resolveModel` only during render and does not subscribe to storage changes, so it keeps displaying and sending requests with the previous model until another render. The learner can receive a response from a model that no longer matches their selection.
Subscribe to model-choice storage changes and update the panel’s model when the selected model changes.
Also at `src/app/components/AiSettings.tsx:163`.
</issue_to_address>
### Comment 4
<location path="src/app/components/AiSettings.tsx" line_range="117" />
<code_context>
provider: p,
configured: await kmHasKey(p),
encrypted: await kmIsEncrypted(p),
+ model: resolveModel(p),
})),
);
</code_context>
<issue_to_address>
**Settings restores an outdated selection**
When a refresh is still waiting on IndexedDB checks after resolving a provider’s model, and the learner changes that provider’s model, `refresh` later applies its earlier snapshot with `setStatuses(next)`, overwriting the learner’s newer radio state even though localStorage contains the new choice. Settings shows a different model from the one the tutor resolves.
Before applying refreshed statuses, preserve the current model choice or re-resolve each provider’s model.
Also at `src/app/components/AiSettings.tsx:166`.
</issue_to_address>
### Comment 5
<location path="src/lib/ai/providers/modelChoices.ts" line_range="40" />
<code_context>
+ readonly hint: string;
+}
+
+export const MODEL_CHOICES: Readonly<Partial<Record<Provider, readonly ModelChoice[]>>> = {
+ // Sonnet 5.5: $2 / $10 per million tokens; Opus 5.5: $4 / $20.
+ openrouter: [
</code_context>
<issue_to_address>
**Role-specific models disappear**
When a teacher, admin, or super_admin opens Paramètres IA, `getModelChoices` and the settings picker select options only by provider, so teacher/admin and super_admin users receive the same Sonnet/Opus/Gemini lists as students; they cannot pick the role-specific models described by the existing picker contract.
Pass the user's role into model-choice resolution and provide the role-specific allowlists, or update the ADR to explicitly replace that contract.
Also at `src/app/components/AiSettings.tsx:262`.
</issue_to_address>
### Comment 6
<location path="src/app/components/AiSettings.tsx" line_range="162" />
<code_context>
+ // Model choice is a plain local preference (not a secret). Update the row
+ // right away, from what `resolveModel` now returns, so the UI only shows a
+ // choice that was actually stored.
+ const onModelChange = useCallback((p: Provider, model: string) => {
+ saveModelChoice(p, model);
+ const effective = resolveModel(p);
</code_context>
<issue_to_address>
**Failed model choice goes unexplained**
When the browser blocks localStorage access or a write fails, `saveModelChoice` returns `false`, but `onModelChange` ignores it and `resolveModel` returns the existing choice. The controlled radio reverts without explaining that the selection was not applied.
Check the result of `saveModelChoice` and show an error when the model choice cannot be saved.
Also at `src/app/components/AiSettings.tsx:163`.
</issue_to_address>
### Comment 7
<location path="src/test/ai/providers/resolveModel.test.ts" line_range="42" />
<code_context>
+
+describe('resolveModel — providers with a picker (OpenRouter, Anthropic, Gemini)', () => {
+ it('uses the cheapest Gemini model by default', () => {
+ expect(resolveModel('gemini')).toBe('gemini-3.5-flash-lite');
+ });
+
</code_context>
<issue_to_address>
**Configured models break default tests**
When the test environment provides `VITE_AI_TUTOR_GEMINI_MODEL=gemini-3.6-flash`, the Gemini default assertions in `uses the cheapest Gemini model by default` (line 42) and `offers Gemini 3.5 Flash-Lite` (line 246) fail when `VITE_AI_TUTOR_GEMINI_MODEL` is set to the offered `gemini-3.6-flash`; `resolveModel` correctly honors that override, so the tests fail despite correct behavior.
Explicitly unset or stub the Gemini model environment variable in tests that assert the code default.
Also at `src/test/app/AiSettings.test.tsx:246`.
</issue_to_address>
### Comment 8
<location path="CHANGELOG.md" line_range="8-14" />
<code_context>
+## 🤖 9 novembre 2026 — Tuteur IA : choisir son modèle, Claude Sonnet 5.5 par défaut
</code_context>
<issue_to_address>
**Decision missing from project story**
When la PR publie le changement important de modèles et de choix élève décrit dans cette entrée du changelog, `STORY.md` ne reçoit pas de chapitre sur cette décision, donc le journal communautaire ne raconte pas ce qui a été appris ou décidé pour cette évolution.
Ajouter un court chapitre dans la partie en cours de `STORY.md` expliquant la décision et ce qui a été appris.
</issue_to_address>
### Comment 9
<location path="CHANGELOG.md" line_range="8-14" />
<code_context>
+## 🤖 9 novembre 2026 — Tuteur IA : choisir son modèle, Claude Sonnet 5.5 par défaut
</code_context>
<issue_to_address>
**Release banners remain stale**
When la PR ajoute cette évolution du tuteur IA au changelog, les bandeaux de `docs/plan.md` et `docs/ROADMAP.md` ne sont pas mis à jour pour cette évolution, donc ces documents continuent d’afficher un état antérieur au changement de modèles.
Mettre à jour les bandeaux de `docs/plan.md` et `docs/ROADMAP.md` pour refléter cette évolution et sa date.
</issue_to_address>
### Comment 10
<location path="src/lib/ai/keyManager.ts" line_range="33-37" />
<code_context>
export const CONSENT_KEY = 'ai_consent_v1';
export const RATE_KEY = 'ai_rate_v1';
export const MODE_KEY = 'ai_tutor_mode';
+/** Prefix for the learner's model choice per provider (`providers/modelChoices.ts`). Not a secret. */
+export const MODEL_KEY_PREFIX = 'ai_tutor_model_';
const DB_NAME = 'ai_keys_encrypted';
</code_context>
<issue_to_address>
**Sensitive-word check returns matches**
When la recherche du diff utilise les termes énumérés par la règle, la recherche des termes imposés renvoie des occurrences dans les commentaires et tests ajoutés (notamment `secret`, `keys` et `token`), donc le contrôle exigeant zéro résultat échoue.
Adapter le texte ajouté pour que la recherche prescrite ne retourne aucun résultat.
Also at `src/lib/ai/providers/modelChoices.ts:16`, `src/lib/ai/providers/anthropic.ts:32-33`, `src/lib/ai/providers/gemini.ts:33-35`, `src/test/ai/providers/anthropic.test.ts:230`, `src/test/ai/providers/gemini.test.ts:215`.
</issue_to_address>Sourcery est gratuit pour les projets open source — si nos avis vous plaisent, pensez à les partager ✨
Original comment in English
Hey - I've found 10 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/lib/ai/keyManager.ts" line_range="305" />
<code_context>
- for (const p of PROVIDERS) ls.removeItem(LS_PREFIX + p);
+ for (const p of PROVIDERS) {
+ ls.removeItem(LS_PREFIX + p);
+ ls.removeItem(MODEL_KEY_PREFIX + p);
+ }
ls.removeItem(PROVIDER_KEY);
</code_context>
<issue_to_address>
**Next learner inherits model choice**
When a Supabase `SIGNED_OUT` event reaches this tab without going through this context’s explicit `signOut` function, `AuthContext` only updates the session in its auth-state listener and does not call `clearAiSessionData`, so the previous learner’s model choice remains in localStorage and `resolveModel` applies it to the next learner.
Run the client-state teardown when the auth-state listener receives `SIGNED_OUT`, not only in the explicit sign-out method.
</issue_to_address>
### Comment 2
<location path="src/lib/ai/providers/modelChoices.ts" line_range="42-52" />
<code_context>
+
+export const MODEL_CHOICES: Readonly<Partial<Record<Provider, readonly ModelChoice[]>>> = {
+ // Sonnet 5.5: $2 / $10 per million tokens; Opus 5.5: $4 / $20.
+ openrouter: [
+ {
+ id: OPENROUTER_DEFAULT_MODEL,
+ label: 'Claude Sonnet 5.5',
+ hint: 'Rapide et précis · choix par défaut',
+ },
+ {
+ id: 'anthropic/claude-opus-5.5',
</code_context>
<issue_to_address>
**OpenRouter Opus answers get cut**
When a learner selects Claude Opus 5.5 for OpenRouter, selecting Claude Opus 5.5 through OpenRouter sends it through the OpenRouter adapter, while the new larger output cap is applied only by the Anthropic adapter. Because Opus thinking consumes output tokens, the OpenRouter request can leave too little of its 1024-token budget for the answer, so students receive cut or empty replies.
Apply the required thinking and output-budget settings to OpenRouter requests for these Claude models, or do not offer Opus there until the adapter supports them.
</issue_to_address>
### Comment 3
<location path="src/app/components/ai/AiTutorPanel.tsx" line_range="112" />
<code_context>
+ // the choice can change on the Settings page while this panel stays
+ // mounted, and opening the panel re-renders it, which re-reads the choice
+ // (one localStorage read).
+ const model = resolveModel(provider);
// THI-148 V1.0.1 — static, public-only platform overview injected as
</code_context>
<issue_to_address>
**Tutor uses the previous model**
When the tutor panel stays mounted while the model changes in Settings in another tab, `AiTutorPanel` calls `resolveModel` only during render and does not subscribe to storage changes, so it keeps displaying and sending requests with the previous model until another render. The learner can receive a response from a model that no longer matches their selection.
Subscribe to model-choice storage changes and update the panel’s model when the selected model changes.
Also at `src/app/components/AiSettings.tsx:163`.
</issue_to_address>
### Comment 4
<location path="src/app/components/AiSettings.tsx" line_range="117" />
<code_context>
provider: p,
configured: await kmHasKey(p),
encrypted: await kmIsEncrypted(p),
+ model: resolveModel(p),
})),
);
</code_context>
<issue_to_address>
**Settings restores an outdated selection**
When a refresh is still waiting on IndexedDB checks after resolving a provider’s model, and the learner changes that provider’s model, `refresh` later applies its earlier snapshot with `setStatuses(next)`, overwriting the learner’s newer radio state even though localStorage contains the new choice. Settings shows a different model from the one the tutor resolves.
Before applying refreshed statuses, preserve the current model choice or re-resolve each provider’s model.
Also at `src/app/components/AiSettings.tsx:166`.
</issue_to_address>
### Comment 5
<location path="src/lib/ai/providers/modelChoices.ts" line_range="40" />
<code_context>
+ readonly hint: string;
+}
+
+export const MODEL_CHOICES: Readonly<Partial<Record<Provider, readonly ModelChoice[]>>> = {
+ // Sonnet 5.5: $2 / $10 per million tokens; Opus 5.5: $4 / $20.
+ openrouter: [
</code_context>
<issue_to_address>
**Role-specific models disappear**
When a teacher, admin, or super_admin opens Paramètres IA, `getModelChoices` and the settings picker select options only by provider, so teacher/admin and super_admin users receive the same Sonnet/Opus/Gemini lists as students; they cannot pick the role-specific models described by the existing picker contract.
Pass the user's role into model-choice resolution and provide the role-specific allowlists, or update the ADR to explicitly replace that contract.
Also at `src/app/components/AiSettings.tsx:262`.
</issue_to_address>
### Comment 6
<location path="src/app/components/AiSettings.tsx" line_range="162" />
<code_context>
+ // Model choice is a plain local preference (not a secret). Update the row
+ // right away, from what `resolveModel` now returns, so the UI only shows a
+ // choice that was actually stored.
+ const onModelChange = useCallback((p: Provider, model: string) => {
+ saveModelChoice(p, model);
+ const effective = resolveModel(p);
</code_context>
<issue_to_address>
**Failed model choice goes unexplained**
When the browser blocks localStorage access or a write fails, `saveModelChoice` returns `false`, but `onModelChange` ignores it and `resolveModel` returns the existing choice. The controlled radio reverts without explaining that the selection was not applied.
Check the result of `saveModelChoice` and show an error when the model choice cannot be saved.
Also at `src/app/components/AiSettings.tsx:163`.
</issue_to_address>
### Comment 7
<location path="src/test/ai/providers/resolveModel.test.ts" line_range="42" />
<code_context>
+
+describe('resolveModel — providers with a picker (OpenRouter, Anthropic, Gemini)', () => {
+ it('uses the cheapest Gemini model by default', () => {
+ expect(resolveModel('gemini')).toBe('gemini-3.5-flash-lite');
+ });
+
</code_context>
<issue_to_address>
**Configured models break default tests**
When the test environment provides `VITE_AI_TUTOR_GEMINI_MODEL=gemini-3.6-flash`, the Gemini default assertions in `uses the cheapest Gemini model by default` (line 42) and `offers Gemini 3.5 Flash-Lite` (line 246) fail when `VITE_AI_TUTOR_GEMINI_MODEL` is set to the offered `gemini-3.6-flash`; `resolveModel` correctly honors that override, so the tests fail despite correct behavior.
Explicitly unset or stub the Gemini model environment variable in tests that assert the code default.
Also at `src/test/app/AiSettings.test.tsx:246`.
</issue_to_address>
### Comment 8
<location path="CHANGELOG.md" line_range="8-14" />
<code_context>
+## 🤖 9 novembre 2026 — Tuteur IA : choisir son modèle, Claude Sonnet 5.5 par défaut
</code_context>
<issue_to_address>
**Decision missing from project story**
When la PR publie le changement important de modèles et de choix élève décrit dans cette entrée du changelog, `STORY.md` ne reçoit pas de chapitre sur cette décision, donc le journal communautaire ne raconte pas ce qui a été appris ou décidé pour cette évolution.
Ajouter un court chapitre dans la partie en cours de `STORY.md` expliquant la décision et ce qui a été appris.
</issue_to_address>
### Comment 9
<location path="CHANGELOG.md" line_range="8-14" />
<code_context>
+## 🤖 9 novembre 2026 — Tuteur IA : choisir son modèle, Claude Sonnet 5.5 par défaut
</code_context>
<issue_to_address>
**Release banners remain stale**
When la PR ajoute cette évolution du tuteur IA au changelog, les bandeaux de `docs/plan.md` et `docs/ROADMAP.md` ne sont pas mis à jour pour cette évolution, donc ces documents continuent d’afficher un état antérieur au changement de modèles.
Mettre à jour les bandeaux de `docs/plan.md` et `docs/ROADMAP.md` pour refléter cette évolution et sa date.
</issue_to_address>
### Comment 10
<location path="src/lib/ai/keyManager.ts" line_range="33-37" />
<code_context>
export const CONSENT_KEY = 'ai_consent_v1';
export const RATE_KEY = 'ai_rate_v1';
export const MODE_KEY = 'ai_tutor_mode';
+/** Prefix for the learner's model choice per provider (`providers/modelChoices.ts`). Not a secret. */
+export const MODEL_KEY_PREFIX = 'ai_tutor_model_';
const DB_NAME = 'ai_keys_encrypted';
</code_context>
<issue_to_address>
**Sensitive-word check returns matches**
When la recherche du diff utilise les termes énumérés par la règle, la recherche des termes imposés renvoie des occurrences dans les commentaires et tests ajoutés (notamment `secret`, `keys` et `token`), donc le contrôle exigeant zéro résultat échoue.
Adapter le texte ajouté pour que la recherche prescrite ne retourne aucun résultat.
Also at `src/lib/ai/providers/modelChoices.ts:16`, `src/lib/ai/providers/anthropic.ts:32-33`, `src/lib/ai/providers/gemini.ts:33-35`, `src/test/ai/providers/anthropic.test.ts:230`, `src/test/ai/providers/gemini.test.ts:215`.
</issue_to_address>A logout from another tab, or a revoked or expired session, reached the auth listener without running the client teardown, so the next learner on a shared computer inherited the previous learner's AI data (model choice included). Sourcery review on #420.
- Tutor panel and Settings follow a choice made in another tab (storage event). - Settings resolves the model after the IndexedDB awaits, so a refresh no longer restores an older choice. - Settings shows a French alert when the browser refuses to store the choice. - OpenRouter: 4096-token output ceiling for Opus 5.5, as on the Anthropic route. - Opus cost hint no longer understates the cost (thinking is billed too). - Tests neutralise VITE_AI_TUTOR_*_MODEL before checking code defaults. Sourcery review on #420.
…model picker ADR-009 amendment: one model list per provider for every role; isolation comes from the per-role prompt, not the model. Sourcery review on #420.
Summary
The AI tutor's Gemini default,
gemini-2.0-flash, was shut down by Google on 2026-06-01, so the Gemini option was failing for visitors who bring their own key. This PR moves every provider to a current model and lets the student choose.AI settings (Paramètres IA): one radio group per provider, with the model name and a relative-cost hint in French.
anthropic/claude-sonnet-5.5anthropic/claude-opus-5.5claude-sonnet-5-5claude-opus-5-5gemini-3.5-flash-lite(cheapest, BYOK)gemini-3.6-flashresolveModelkeeps a single mechanism. Priority: the student's choice, then theVITE_AI_TUTOR_<PROVIDER>_MODELenv var if it is one of the offered models, then the code default. A shut-down value (gemini-2.0-flash,gemini-2.5-*,claude-sonnet-4-6) is ignored, and removed when it was stored..env.example,anthropic/claude-sonnet-4-6, was not a valid OpenRouter id (the id uses a dot:claude-sonnet-4.6).thinkingLevel=MINIMALis sent only to the models the docs list as accepting it. Anthropic: Sonnet 5.5 getsthinking: {type: "between_tools"}; Opus 5.5 always thinks, so it gets nothinkingfield and a 4096-token output ceiling.localStorage(ai_tutor_model_<provider>, not a secret) and cleared on sign-out (clearAiSessionData).fieldsetandlegend, an accessible name and description, arrow-key navigation (tested).Verification
tsc --noEmitOK,eslint srcOK,vitest run: 3055 passed, 59 skipped, 0 failed (465 AI tests),vite buildOK, gitleaks clean./api/v1/modelslist.Follow-ups
VITE_AI_TUTOR_OPENROUTER_MODELtoanthropic/claude-sonnet-5.5.Résumé par Sourcery
Mise à jour du tuteur IA pour utiliser les modèles actuels des fournisseurs et permettre aux apprenants de choisir leur option Claude ou Gemini préférée.
Nouvelles fonctionnalités :
Corrections de bugs :
Améliorations :
Déploiement :
Documentation :
Tests :
Original summary in English
Résumé par Sourcery
Mise à jour du tuteur IA pour utiliser les modèles pris en charge par les fournisseurs et permettre aux apprenants de choisir l’option Claude ou Gemini qui correspond le mieux à leurs besoins en matière de qualité et de coût.
Nouvelles fonctionnalités :
Corrections de bogues :
Améliorations :
Déploiement :
Documentation :
Tests :
Original summary in English
Summary by Sourcery
Update the AI tutor to use supported provider models and let learners select the Claude or Gemini option that best fits their quality and cost needs.
New Features:
Bug Fixes:
Enhancements:
Deployment:
Documentation:
Tests: