feat: chat intégré par fichier — panneau latéral, historique, temps réel SSE #169
- Store backend `backend/file_chat.py` : messages JSON par (vault, path)
sous `data/chats/` (nom hashé SHA-256 → traversal impossible), plafond
500 messages, texte tronqué à 4000 caractères, écriture atomique.
- Routes `GET/POST /api/file/{vault}/chat` : auth + accès vault +
`resolve_safe_path`, schémas Pydantic (`response_model`), broadcast SSE
`chat_message` sur le transport existant (#62) — pas de second WebSocket.
- Panneau latéral `frontend/js/filechat.js` : bouton 💬 dans la toolbar
fichier, historique chronologique, envoi optimiste + dédoublonnage par id,
toast « Nouveau message » si le panneau est fermé/autre fichier.
- Relais SSE dans `sync.js` (import dynamique), CSS bloc #169 (plein écran
≤ 768 px, input 16 px anti-zoom), i18n FR/EN (10 clés `chat.*`).
- Tests : `tests/test_file_chat.py` (15) + `tests/frontend/filechat.test.mjs`
(6, ajouté au pipeline CI), regex toolbar-order mise à jour.
- Docs : CHANGELOG [Unreleased], ROADMAP #169 → livré + index, fiche
`docs/features/file-chat-169.md`, guide « Discuter d'un fichier ».
This commit is contained in:
@@ -13748,3 +13748,142 @@ body.reading-mode .file-actions {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
#169 — Chat intégré par fichier (panneau latéral)
|
||||
--------------------------------------------------------------------------- */
|
||||
.file-chat-panel {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 340px;
|
||||
max-width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--bg-primary, #0d1117);
|
||||
border-left: 1px solid var(--border, #21262d);
|
||||
box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
|
||||
z-index: 1500;
|
||||
}
|
||||
.file-chat-panel.hidden {
|
||||
display: none;
|
||||
}
|
||||
.file-chat-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
padding: 12px 14px;
|
||||
border-bottom: 1px solid var(--border, #21262d);
|
||||
}
|
||||
.file-chat-header h3 {
|
||||
margin: 0;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary, #e6edf3);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.file-chat-close {
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-muted, #8b949e);
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
padding: 4px 8px;
|
||||
border-radius: 6px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.file-chat-close:hover {
|
||||
background: var(--bg-hover, rgba(128, 128, 128, 0.18));
|
||||
color: var(--text-primary, #e6edf3);
|
||||
}
|
||||
.file-chat-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 12px 14px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.file-chat-empty {
|
||||
color: var(--text-muted, #8b949e);
|
||||
font-size: 0.85rem;
|
||||
text-align: center;
|
||||
padding: 24px 8px;
|
||||
}
|
||||
.file-chat-msg {
|
||||
background: var(--bg-secondary, #161b22);
|
||||
border: 1px solid var(--border, #21262d);
|
||||
border-radius: 10px;
|
||||
padding: 8px 10px;
|
||||
max-width: 92%;
|
||||
}
|
||||
.file-chat-msg.mine {
|
||||
align-self: flex-end;
|
||||
background: var(--bg-hover, rgba(88, 166, 255, 0.12));
|
||||
border-color: var(--accent, #58a6ff);
|
||||
}
|
||||
.file-chat-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
font-size: 0.72rem;
|
||||
color: var(--text-muted, #8b949e);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.file-chat-user {
|
||||
font-weight: 600;
|
||||
color: var(--accent, #58a6ff);
|
||||
}
|
||||
.file-chat-body {
|
||||
font-size: 0.88rem;
|
||||
color: var(--text-primary, #e6edf3);
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
.file-chat-form {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 10px 14px;
|
||||
border-top: 1px solid var(--border, #21262d);
|
||||
}
|
||||
.file-chat-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 8px 10px;
|
||||
font-size: 16px; /* anti-zoom iOS */
|
||||
border: 1px solid var(--border, #21262d);
|
||||
border-radius: 8px;
|
||||
background: var(--bg-secondary, #161b22);
|
||||
color: var(--text-primary, #e6edf3);
|
||||
}
|
||||
.file-chat-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent, #58a6ff);
|
||||
}
|
||||
.file-chat-send {
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
padding: 8px 14px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
background: var(--accent, #58a6ff);
|
||||
color: #fff;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.file-chat-send:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.file-chat-panel {
|
||||
width: 100vw;
|
||||
border-left: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user