R42 was missing knowledge-graph information (e.g. pension questions) because retrieval and context-building dropped relevant facts: - retrieval: exact-token TF-IDF could not match Dutch compound words, so a "pensioen" query scored 0 against "pensioenregeling" / "partnerpensioen" and never retrieved them. Add a compound-word fallback (shared >=6-char stem or containment, 0.4x weight) alongside exact matching. - rag: deep article content was only injected for verbatim-mentioned topics; retrieved topics contributed just a 200-char description. Inject ~1000 chars of content for up to 5 topics (mentions first, then top-ranked retrieved) and widen the description snippet to 320. - prompts: add a NAUWKEURIGHEID block (use all relevant facts, call lookup_topic before giving up) and relax the 4-sentence cap for detail/list answers so complete facts aren't summarised away. Also add a clear-history control: a trash button in the chat header (confirm dialog) wipes chat🧵{userId} and reseeds the greeting via clearThread() in useChat. Tests: compound-word matching + rag deep-content injection. Spec updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
251 lines
5.8 KiB
CSS
251 lines
5.8 KiB
CSS
/* R42 chatbot — FAB + chat window */
|
|
|
|
.r42-fab {
|
|
position: fixed;
|
|
right: 24px;
|
|
bottom: 80px;
|
|
width: 64px;
|
|
height: 64px;
|
|
border-radius: var(--r-pill);
|
|
background: var(--teal-900);
|
|
display: grid;
|
|
place-items: center;
|
|
box-shadow: var(--shadow-pill);
|
|
cursor: pointer;
|
|
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
border: 2px solid var(--cream);
|
|
z-index: 60;
|
|
padding: 0;
|
|
}
|
|
.r42-fab:hover { transform: translateY(-2px); }
|
|
.r42-fab:focus-visible {
|
|
outline: 2px solid var(--purple);
|
|
outline-offset: 3px;
|
|
}
|
|
.r42-fab.open {
|
|
bottom: calc(80px + 480px - 56px);
|
|
width: 48px;
|
|
height: 48px;
|
|
}
|
|
|
|
@media (min-width: 768px) {
|
|
.r42-fab { bottom: 24px; }
|
|
.r42-fab.open { bottom: calc(24px + 480px - 56px); }
|
|
}
|
|
|
|
.r42-window {
|
|
position: fixed;
|
|
right: 24px;
|
|
bottom: 80px;
|
|
width: min(380px, calc(100vw - 32px));
|
|
height: min(480px, calc(100vh - 120px));
|
|
background: var(--paper);
|
|
border-radius: var(--r-md);
|
|
border: 1px solid rgba(31, 85, 96, 0.06);
|
|
box-shadow: var(--shadow-pill);
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow: hidden;
|
|
z-index: 60;
|
|
}
|
|
@media (min-width: 768px) {
|
|
.r42-window { bottom: 24px; }
|
|
}
|
|
|
|
.r42-window-hd {
|
|
background: var(--teal-900);
|
|
color: var(--cream);
|
|
padding: var(--s-3) var(--s-4);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--s-3);
|
|
flex-shrink: 0;
|
|
}
|
|
.r42-window-hd .av {
|
|
width: 36px;
|
|
height: 36px;
|
|
border-radius: var(--r-pill);
|
|
background: var(--teal);
|
|
display: grid;
|
|
place-items: center;
|
|
flex-shrink: 0;
|
|
}
|
|
.r42-window-hd-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
|
.r42-window-hd-name { font: 600 14px/1 var(--font-sans); }
|
|
.r42-window-hd-status {
|
|
font: 500 var(--t-label)/1 var(--font-mono);
|
|
letter-spacing: var(--label-ls);
|
|
text-transform: uppercase;
|
|
color: rgba(236, 233, 233, 0.6);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
}
|
|
.r42-window-hd-status i {
|
|
width: 5px;
|
|
height: 5px;
|
|
border-radius: 999px;
|
|
background: var(--sage);
|
|
}
|
|
.r42-window-hd-actions {
|
|
margin-left: auto;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 2px;
|
|
}
|
|
.r42-window-hd-x {
|
|
color: rgba(236, 233, 233, 0.7);
|
|
background: transparent;
|
|
border: none;
|
|
font-size: 22px;
|
|
line-height: 1;
|
|
cursor: pointer;
|
|
padding: 4px 8px;
|
|
border-radius: var(--r-sm);
|
|
}
|
|
.r42-window-hd-x:hover { background: rgba(236, 233, 233, 0.1); }
|
|
.r42-window-hd-clear {
|
|
color: rgba(236, 233, 233, 0.7);
|
|
background: transparent;
|
|
border: none;
|
|
cursor: pointer;
|
|
padding: 6px;
|
|
border-radius: var(--r-sm);
|
|
display: grid;
|
|
place-items: center;
|
|
}
|
|
.r42-window-hd-clear:hover { background: rgba(236, 233, 233, 0.1); }
|
|
.r42-window-hd-clear:disabled { opacity: 0.4; cursor: default; }
|
|
|
|
.r42-window-body {
|
|
flex: 1;
|
|
padding: var(--s-4);
|
|
background: var(--cream);
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--s-3);
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.r42-msg { display: flex; gap: var(--s-2); align-items: flex-end; }
|
|
.r42-msg .av-sm {
|
|
width: 26px;
|
|
height: 26px;
|
|
border-radius: var(--r-pill);
|
|
background: var(--teal-900);
|
|
display: grid;
|
|
place-items: center;
|
|
flex-shrink: 0;
|
|
}
|
|
.r42-msg .bub {
|
|
background: var(--paper);
|
|
border-radius: 16px 16px 16px 4px;
|
|
padding: 10px 14px;
|
|
font: 400 14px/1.45 var(--font-sans);
|
|
color: var(--ink);
|
|
max-width: 250px;
|
|
border: 1px solid rgba(31, 85, 96, 0.06);
|
|
word-wrap: break-word;
|
|
}
|
|
.r42-msg.me { justify-content: flex-end; }
|
|
.r42-msg.me .bub {
|
|
background: var(--teal);
|
|
color: var(--cream);
|
|
border: none;
|
|
border-radius: 16px 16px 4px 16px;
|
|
}
|
|
.r42-msg.error .bub {
|
|
background: #fee2e2;
|
|
color: #991b1b;
|
|
border: 1px solid #fecaca;
|
|
}
|
|
|
|
.r42-suggestion {
|
|
margin-top: var(--s-2);
|
|
padding: 10px 12px;
|
|
background: rgba(92, 29, 216, 0.08);
|
|
border: 1px solid rgba(92, 29, 216, 0.2);
|
|
border-radius: var(--r-sm);
|
|
font: 400 13px/1.4 var(--font-sans);
|
|
color: var(--ink);
|
|
}
|
|
.r42-suggestion-title {
|
|
font-weight: 600;
|
|
color: var(--purple);
|
|
margin-bottom: 6px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
}
|
|
.r42-suggestion-items {
|
|
margin: 6px 0 10px;
|
|
padding-left: 16px;
|
|
list-style: disc;
|
|
}
|
|
.r42-suggestion-items li { margin: 2px 0; }
|
|
.r42-suggestion-actions {
|
|
display: flex;
|
|
gap: 6px;
|
|
}
|
|
.r42-suggestion-actions button {
|
|
flex: 1;
|
|
padding: 6px 10px;
|
|
border-radius: var(--r-pill);
|
|
border: 1px solid rgba(92, 29, 216, 0.3);
|
|
font: 600 12px/1 var(--font-sans);
|
|
cursor: pointer;
|
|
background: var(--paper);
|
|
color: var(--purple);
|
|
transition: background 0.15s ease, color 0.15s ease;
|
|
}
|
|
.r42-suggestion-actions button.primary {
|
|
background: var(--purple);
|
|
color: var(--cream);
|
|
border-color: var(--purple);
|
|
}
|
|
.r42-suggestion-actions button.primary:hover { background: var(--purple-700); }
|
|
.r42-suggestion-actions button:not(.primary):hover { background: rgba(92, 29, 216, 0.1); }
|
|
.r42-suggestion-status {
|
|
margin-top: 6px;
|
|
font: 500 11px/1 var(--font-mono);
|
|
letter-spacing: var(--label-ls);
|
|
text-transform: uppercase;
|
|
color: var(--fg-muted);
|
|
}
|
|
|
|
.r42-window-input {
|
|
padding: var(--s-3) var(--s-4);
|
|
background: var(--paper);
|
|
border-top: 1px solid rgba(31, 85, 96, 0.06);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--s-2);
|
|
flex-shrink: 0;
|
|
}
|
|
.r42-window-input input {
|
|
flex: 1;
|
|
background: var(--cream);
|
|
border: none;
|
|
outline: none;
|
|
border-radius: var(--r-pill);
|
|
padding: 10px 14px;
|
|
font: 400 14px/1 var(--font-sans);
|
|
color: var(--ink);
|
|
min-width: 0;
|
|
}
|
|
.r42-window-input input::placeholder { color: rgba(60, 58, 58, 0.4); }
|
|
.r42-window-input input:disabled { opacity: 0.5; }
|
|
.r42-window-input button {
|
|
background: var(--purple);
|
|
color: var(--cream);
|
|
border: none;
|
|
border-radius: var(--r-pill);
|
|
padding: 10px 18px;
|
|
font: 600 13px/1 var(--font-sans);
|
|
cursor: pointer;
|
|
transition: background 0.15s ease;
|
|
flex-shrink: 0;
|
|
}
|
|
.r42-window-input button:hover:not(:disabled) { background: var(--purple-700); }
|
|
.r42-window-input button:disabled { opacity: 0.4; cursor: not-allowed; }
|