feat(chatbot): mode profondeur côté serveur (rapide / approfondi) sur les 4 routes

Contrat unique `profondeur` ('rapide' | 'approfondi', défaut rapide) dans
utils/chatProfondeur.ts (libellés partagés). Les 3 routes Bifrost lisent
body.profondeur ?? body.mode, choisissent le tier (20b / 120b + replis), un
prompt système « réflexion » (Entraide, Réseaux, Taff) au même format JSON, et un
budget max_tokens adapté. Pensées lit body.profondeur (jamais body.mode, réservé à
LightRAG) : posture réflexion ajoutée au user_prompt + max_total_tokens 40000.
Modèle servi journalisé, et champ debug exposé uniquement en dev.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vcVGz8i4WpZm2dixKUiSD
This commit is contained in:
Jules Neny
2026-10-09 03:45:27 +02:00
co-authored by Claude Opus 5.5
parent 75d8440601
commit 80f69565aa
6 changed files with 198 additions and 19 deletions
+27
View File
@@ -0,0 +1,27 @@
/**
* Mode de profondeur des chatbots (M3) — contrat partagé front/serveur.
* Champ de body : `profondeur` = 'rapide' | 'approfondi' (défaut 'rapide').
* Les libellés affichés vivent ICI, à un seul endroit : les changer ne touche ni
* le composant ni le serveur.
*/
export type ChatProfondeur = 'rapide' | 'approfondi'
export const CHAT_PROFONDEUR_DEFAUT: ChatProfondeur = 'rapide'
export const CHAT_PROFONDEUR_LIBELLES: Record<ChatProfondeur, string> = {
rapide: 'Question',
approfondi: 'Réflexion plus profonde',
}
/** Sous-texte (title/aria) de chaque option. */
export const CHAT_PROFONDEUR_AIDES: Record<ChatProfondeur, string> = {
rapide: 'Réponse directe et concise',
approfondi: 'Une réponse plus longue, qui questionne ton besoin avant de répondre',
}
export const CHAT_PROFONDEURS = Object.keys(CHAT_PROFONDEUR_LIBELLES) as ChatProfondeur[]
/** Normalise une valeur inconnue (body, stockage) vers un mode valide. */
export function normaliserProfondeur(v: unknown): ChatProfondeur {
return v === 'approfondi' ? 'approfondi' : 'rapide'
}