feat(chatbot): toggle de mode branché sur les 5 interfaces chatbot

Placeholder (/ et /agences desktop), Sheet (/ mobile), Réseaux (/agences mobile),
chatbot de /trouver-du-taf et Pensées (/media) envoient `profondeur` dans le body
et l'enregistrent sur chaque message (badge conservé à la restauration).

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:49:56 +02:00
co-authored by Claude Opus 5.5
parent 4c57f30f6a
commit 52b79e1e8e
5 changed files with 70 additions and 9 deletions
+17 -2
View File
@@ -60,6 +60,7 @@
<template v-for="(msg, i) in messages" :key="i">
<div v-if="msg.role === 'user'" class="user-bubble">{{ msg.content }}</div>
<div v-else class="assistant-bubble">
<ChatModeBadge :profondeur="msg.profondeur" />
<div v-if="rendreMarkdown" v-html="renderMd(msg.content)" />
<p v-else>{{ msg.content }}</p>
<div v-if="msg.fiches && msg.fiches.length > 0" class="fiches-list">
@@ -103,8 +104,13 @@
<ChatNewConversation v-if="hasHistory && !loading" @reset="nouvelleConversation" />
</div>
<!-- Mode de réponse -->
<div class="chatbot-mode-row" style="border-top: 1px solid var(--nav-bg-alt);">
<ChatModeToggle v-model="profondeur" :disabled="loading" />
</div>
<!-- Input -->
<div class="chatbot-input-row" style="border-top: 1px solid var(--nav-bg-alt);">
<div class="chatbot-input-row">
<input
v-model="inputText"
type="text"
@@ -144,6 +150,7 @@ interface ChatMessage {
content: string
fiches?: FicheReco[]
suggestedHashtags?: string[]
profondeur?: string
}
// Composant unique pour les deux chatbots desktop. Les défauts reproduisent
@@ -194,6 +201,7 @@ const emit = defineEmits<{
const isExpanded = ref(false)
const { messages, hasHistory, clear } = useChatSession<ChatMessage>(() => props.chatKey)
const profondeur = useChatProfondeur(() => props.chatKey)
const inputText = ref('')
const loading = ref(false)
const errorMsg = ref('')
@@ -247,6 +255,7 @@ async function sendMessage() {
errorMsg.value = ''
messages.value.push({ role: 'user', content: question })
loading.value = true
const mode = profondeur.value
await nextTick()
scrollToBottom()
@@ -257,7 +266,7 @@ async function sendMessage() {
fiches_recommandees: { id: number | string; nom: string; explication: string }[]
}>(props.endpoint, {
method: 'POST',
body: { question },
body: { question, profondeur: mode },
})
const suggestedHashtags = detectHashtagsFromQuery(question)
@@ -266,6 +275,7 @@ async function sendMessage() {
content: res.reponse_texte,
fiches: res.fiches_recommandees || [],
suggestedHashtags: suggestedHashtags.length ? suggestedHashtags : undefined,
profondeur: mode,
}
messages.value.push(assistantMsg)
@@ -357,6 +367,11 @@ function scrollToBottom() {
gap: 8px;
}
.chatbot-mode-row {
display: flex;
padding: 8px 12px 0;
flex-shrink: 0;
}
.chatbot-input-row {
display: flex;
align-items: center;