Aspect 2/4 Léa : interface conversationnelle
- chat_interface.py : ChatSession thread-safe, états idle/planning/awaiting/executing/done
- 5 endpoints REST : /api/v1/chat/* (session, message, history, confirm, sessions)
- web_dashboard/chat.html + chat.js : UI minimaliste, polling 2s, pas de framework
- Proxy Flask /api/chat/* → serveur streaming
- 34 tests (happy path, abandon, refus, erreurs, gemma4 down)
IRBuilder enrichi pour plans V4 complets
- _event_to_action() appelle enrich_click_from_screenshot() quand session_dir dispo
- Chaque clic porte _enrichment (by_text OCR, anchor_image_base64, vlm_description)
- ExecutionCompiler consomme l'enrichissement pour produire 3 stratégies par clic
Avant : [ocr] uniquement, target="unknown_window"
Après : [ocr, template, vlm] avec vrai texte OCR ("Rechercher", "Ouvrir")
Validé sur session réelle : 10/10 clics enrichis (by_text + anchor + vlm_description)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
310 lines
9.3 KiB
HTML
310 lines
9.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Léa — Chat RPA Vision V3</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background: #0f172a;
|
|
color: #e2e8f0;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
.header {
|
|
background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
|
|
color: white;
|
|
padding: 16px 24px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
|
}
|
|
.header h1 {
|
|
font-size: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
.header .home-link {
|
|
color: rgba(255,255,255,0.85);
|
|
text-decoration: none;
|
|
font-size: 13px;
|
|
padding: 6px 14px;
|
|
border-radius: 6px;
|
|
background: rgba(255,255,255,0.1);
|
|
transition: background 0.2s;
|
|
}
|
|
.header .home-link:hover { background: rgba(255,255,255,0.2); }
|
|
|
|
.chat-wrapper {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
max-width: 900px;
|
|
width: 100%;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
gap: 16px;
|
|
}
|
|
|
|
.status-bar {
|
|
background: #1e293b;
|
|
border: 1px solid #334155;
|
|
border-radius: 12px;
|
|
padding: 12px 18px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 12px;
|
|
font-size: 14px;
|
|
}
|
|
.status-bar .status-label {
|
|
color: #94a3b8;
|
|
}
|
|
.status-bar .status-value {
|
|
font-weight: 600;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
.status-dot {
|
|
width: 10px;
|
|
height: 10px;
|
|
border-radius: 50%;
|
|
background: #64748b;
|
|
}
|
|
.status-dot.idle { background: #64748b; }
|
|
.status-dot.planning { background: #f59e0b; animation: pulse 1.2s infinite; }
|
|
.status-dot.awaiting_confirmation { background: #3b82f6; animation: pulse 1.8s infinite; }
|
|
.status-dot.executing { background: #22c55e; animation: pulse 1s infinite; }
|
|
.status-dot.done { background: #22c55e; }
|
|
.status-dot.error { background: #ef4444; }
|
|
@keyframes pulse {
|
|
0%, 100% { opacity: 1; transform: scale(1); }
|
|
50% { opacity: 0.5; transform: scale(1.15); }
|
|
}
|
|
|
|
.messages {
|
|
flex: 1;
|
|
background: #1e293b;
|
|
border: 1px solid #334155;
|
|
border-radius: 12px;
|
|
padding: 20px;
|
|
overflow-y: auto;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 14px;
|
|
min-height: 400px;
|
|
max-height: calc(100vh - 320px);
|
|
}
|
|
.messages::-webkit-scrollbar { width: 8px; }
|
|
.messages::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
|
|
.messages::-webkit-scrollbar-track { background: transparent; }
|
|
|
|
.message {
|
|
display: flex;
|
|
gap: 12px;
|
|
max-width: 85%;
|
|
animation: fadeIn 0.25s ease-out;
|
|
}
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; transform: translateY(6px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
.message.user {
|
|
align-self: flex-end;
|
|
flex-direction: row-reverse;
|
|
}
|
|
.message .avatar {
|
|
width: 34px;
|
|
height: 34px;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 16px;
|
|
flex-shrink: 0;
|
|
font-weight: 600;
|
|
}
|
|
.message.user .avatar {
|
|
background: #3b82f6;
|
|
color: white;
|
|
}
|
|
.message.lea .avatar {
|
|
background: linear-gradient(135deg, #8b5cf6, #ec4899);
|
|
color: white;
|
|
}
|
|
.message.system .avatar {
|
|
background: #475569;
|
|
color: #cbd5e1;
|
|
}
|
|
.message .bubble {
|
|
background: #334155;
|
|
padding: 12px 16px;
|
|
border-radius: 14px;
|
|
line-height: 1.5;
|
|
font-size: 14px;
|
|
white-space: pre-wrap;
|
|
word-wrap: break-word;
|
|
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
|
}
|
|
.message.user .bubble {
|
|
background: #1d4ed8;
|
|
color: white;
|
|
}
|
|
.message.lea .bubble {
|
|
background: #334155;
|
|
}
|
|
.message.system .bubble {
|
|
background: transparent;
|
|
border: 1px dashed #475569;
|
|
color: #94a3b8;
|
|
font-style: italic;
|
|
}
|
|
.message .timestamp {
|
|
font-size: 11px;
|
|
color: #64748b;
|
|
margin-top: 4px;
|
|
}
|
|
|
|
.confirm-bar {
|
|
background: #1e293b;
|
|
border: 1px solid #3b82f6;
|
|
border-radius: 12px;
|
|
padding: 14px 18px;
|
|
display: none;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 12px;
|
|
}
|
|
.confirm-bar.visible { display: flex; }
|
|
.confirm-bar .label {
|
|
font-size: 14px;
|
|
color: #93c5fd;
|
|
font-weight: 500;
|
|
}
|
|
.confirm-bar .actions { display: flex; gap: 10px; }
|
|
.btn {
|
|
padding: 9px 20px;
|
|
border-radius: 8px;
|
|
border: none;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.15s;
|
|
}
|
|
.btn-confirm {
|
|
background: #22c55e;
|
|
color: white;
|
|
}
|
|
.btn-confirm:hover { background: #16a34a; }
|
|
.btn-cancel {
|
|
background: #475569;
|
|
color: #e2e8f0;
|
|
}
|
|
.btn-cancel:hover { background: #64748b; }
|
|
.btn:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.composer {
|
|
background: #1e293b;
|
|
border: 1px solid #334155;
|
|
border-radius: 12px;
|
|
padding: 14px;
|
|
display: flex;
|
|
gap: 10px;
|
|
align-items: flex-end;
|
|
}
|
|
.composer textarea {
|
|
flex: 1;
|
|
background: #0f172a;
|
|
border: 1px solid #334155;
|
|
border-radius: 8px;
|
|
padding: 10px 14px;
|
|
color: #e2e8f0;
|
|
font-family: inherit;
|
|
font-size: 14px;
|
|
resize: none;
|
|
min-height: 42px;
|
|
max-height: 120px;
|
|
line-height: 1.5;
|
|
}
|
|
.composer textarea:focus {
|
|
outline: none;
|
|
border-color: #3b82f6;
|
|
}
|
|
.composer textarea:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
}
|
|
.composer .btn-send {
|
|
background: #3b82f6;
|
|
color: white;
|
|
padding: 10px 22px;
|
|
}
|
|
.composer .btn-send:hover { background: #2563eb; }
|
|
|
|
.progress-bar {
|
|
margin-top: 8px;
|
|
height: 6px;
|
|
background: #0f172a;
|
|
border-radius: 3px;
|
|
overflow: hidden;
|
|
}
|
|
.progress-bar .fill {
|
|
height: 100%;
|
|
background: linear-gradient(90deg, #3b82f6, #22c55e);
|
|
width: 0%;
|
|
transition: width 0.4s ease;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<h1>Léa — Assistant RPA Vision V3</h1>
|
|
<a href="/" class="home-link">Retour au dashboard</a>
|
|
</div>
|
|
|
|
<div class="chat-wrapper">
|
|
<div class="status-bar">
|
|
<div>
|
|
<span class="status-label">État :</span>
|
|
<span class="status-value">
|
|
<span class="status-dot idle" id="statusDot"></span>
|
|
<span id="statusText">En attente</span>
|
|
</span>
|
|
</div>
|
|
<div id="sessionInfo" style="color:#64748b;font-size:12px;">Aucune session</div>
|
|
</div>
|
|
|
|
<div class="messages" id="messages"></div>
|
|
|
|
<div class="confirm-bar" id="confirmBar">
|
|
<div class="label">Léa propose un plan. Confirmer l'exécution ?</div>
|
|
<div class="actions">
|
|
<button class="btn btn-cancel" onclick="confirmPlan(false)">Non, annuler</button>
|
|
<button class="btn btn-confirm" onclick="confirmPlan(true)">Oui, y aller</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="composer">
|
|
<textarea
|
|
id="composerInput"
|
|
placeholder="Dites à Léa ce que vous voulez faire (ex. « Ouvre le Bloc-notes et écris bonjour »)…"
|
|
rows="1"
|
|
onkeydown="handleKeydown(event)"
|
|
></textarea>
|
|
<button class="btn btn-send" id="sendBtn" onclick="sendMessage()">Envoyer</button>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/static/js/chat.js"></script>
|
|
</body>
|
|
</html>
|