Spaces:
Paused

assistant / ui /web /src /components /chat /MessageList.css
localailb's picture
Deploy Full LocalAiLab Application (FastAPI + Svelte + Agents)
bc9f3e6 verified
Raw History Blame Contribute Delete
18.9 kB
/* ==========================================================================
MessageList β€” conversation bubbles + server-side rich HTML
--------------------------------------------------------------------------
Imported by MessageList.svelte. Also imported by DataTab / SttTab /
AboutTab, which render the same `.rich` / `.msg` classes for report
previews and the About markdown. The server HTML classes below are the
EXACT classes emitted by backend/chat.py + agents/agent_streaming.py β€”
keep them in sync with those modules.
========================================================================== */
.messages {
flex: 1;
min-height: 0;
overflow-y: auto;
padding: 26px 0 12px;
}
.messages-inner {
max-width: 860px;
margin: 0 auto;
padding: 0 26px;
display: flex;
flex-direction: column;
gap: 18px;
}
.msg {
display: flex;
align-items: flex-start;
gap: 6px;
}
.msg-user {
justify-content: flex-end;
}
.user-bubble {
background: var(--accent-soft);
color: var(--ink);
border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
border-radius: var(--radius) var(--radius) 4px var(--radius);
padding: 10px 15px;
max-width: 78%;
white-space: pre-wrap;
word-break: break-word;
box-shadow: var(--shadow-sm);
user-select: text;
}
.msg-ai {
justify-content: flex-start;
}
.ai-bubble {
max-width: 100%;
min-width: 0;
}
.rich {
min-width: 0;
word-break: break-word;
user-select: text;
}
/* Per-message copy button β€” a small icon beside the bubble (user: left of
the bubble, answer: right of it), always visible but subtle, brightening
on hover/focus. Flips to a βœ“ (ok-tinted) for a moment after copying. */
.msg-copy-btn {
flex: 0 0 auto;
width: 26px;
height: 26px;
margin-top: 4px;
border: 1px solid transparent;
border-radius: 7px;
background: transparent;
color: var(--ink-faint);
display: inline-flex;
align-items: center;
justify-content: center;
cursor: pointer;
opacity: 0.55;
transition: opacity 0.12s ease, color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.msg:hover .msg-copy-btn,
.msg-copy-btn:focus-visible {
opacity: 1;
}
.msg-copy-btn:hover {
color: var(--accent-ink);
border-color: var(--line);
background: var(--bg-elev);
}
.msg-copy-btn.copied {
color: var(--ok);
opacity: 1;
}
.rich > :first-child {
margin-top: 0;
}
.rich > :last-child {
margin-bottom: 0;
}
/* live streaming caret on the current assistant bubble */
.msg-ai.live .rich::after {
content: "";
display: inline-block;
width: 8px;
height: 15px;
margin-left: 3px;
vertical-align: -2px;
border-radius: 2px;
background: var(--accent);
animation: blink 0.9s steps(2, start) infinite;
}
@keyframes blink {
50% {
opacity: 0;
}
}
/* thinking placeholder */
.think-pulse {
display: inline-flex;
align-items: center;
gap: 8px;
color: var(--ink-soft);
font-size: 13.5px;
}
.think-pulse .dots span {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent);
margin-right: 4px;
animation: dotpulse 1.2s ease-in-out infinite;
}
.think-pulse .dots span:nth-child(2) {
animation-delay: 0.15s;
}
.think-pulse .dots span:nth-child(3) {
animation-delay: 0.3s;
}
@keyframes dotpulse {
0%,
100% {
opacity: 0.3;
transform: translateY(0);
}
50% {
opacity: 1;
transform: translateY(-3px);
}
}
/* ==========================================================================
Active Generation Status Card & Live Step Tracker
========================================================================== */
.active-status-card {
background: transparent;
border: none;
border-radius: 0;
padding: 4px 0;
box-shadow: none;
display: flex;
flex-direction: column;
gap: 6px;
min-width: 0;
max-width: 100%;
position: relative;
}
.active-status-card::before {
display: none;
}
.status-header {
display: flex;
align-items: center;
gap: 8px;
}
.status-pulse-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 0 0 rgba(217, 119, 87, 0.7);
animation: pulse-ring 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
flex-shrink: 0;
}
@keyframes pulse-ring {
0% {
box-shadow: 0 0 0 0 rgba(217, 119, 87, 0.7);
}
70% {
box-shadow: 0 0 0 8px rgba(217, 119, 87, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(217, 119, 87, 0);
}
}
.status-title {
font-weight: 600;
font-size: 13.5px;
color: var(--ink);
flex: 1;
}
.status-timer {
font-size: 12px;
font-family: var(--font-code);
color: var(--ink-faint);
background: var(--bg-soft);
padding: 2px 7px;
border-radius: 10px;
border: 1px solid var(--line);
}
.status-detail {
font-size: 12.5px;
color: var(--ink-soft);
line-height: 1.4;
}
.status-slow-hint {
font-size: 12px;
line-height: 1.35;
color: #b45309;
background: #fef3c7;
border: 1px solid #fde68a;
border-radius: 6px;
padding: 6px 10px;
margin-top: 4px;
}
:global([data-theme="dark"]) .status-slow-hint {
color: #fbbf24;
background: rgba(245, 158, 11, 0.15);
border-color: rgba(245, 158, 11, 0.3);
}
.model-dl-progress-card {
background: var(--bg-soft, #f8f6f0);
border: 1px solid var(--line, #e7e0d3);
border-left: 4px solid var(--accent, #d97757);
border-radius: 8px;
padding: 10px 14px;
margin-top: 6px;
display: flex;
flex-direction: column;
gap: 8px;
}
.model-dl-progress-header {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12.5px;
font-weight: 600;
color: var(--ink, #3f332b);
}
.model-dl-progress-track {
width: 100%;
height: 8px;
background: var(--bg, #ffffff);
border-radius: 4px;
overflow: hidden;
border: 1px solid var(--line, #e7e0d3);
position: relative;
}
.model-dl-progress-fill {
height: 100%;
background: linear-gradient(90deg, var(--accent, #d97757), #e06d44);
border-radius: 4px;
transition: width 0.3s ease;
min-width: 6px;
}
.model-dl-progress-fill.indeterminate {
width: 40% !important;
animation: dl-indeterminate 1.5s infinite linear;
}
@keyframes dl-indeterminate {
0% { transform: translateX(-100%); }
100% { transform: translateX(300%); }
}
/* --------------------------------------------------------------------------
Server-side HTML rendered by {#html} β€” the exact classes emitted by
backend/chat.py + agents/agent_streaming.py
-------------------------------------------------------------------------- */
.rich h1,
.rich h2,
.rich h3 {
font-family: var(--font-display);
line-height: 1.3;
margin: 1.2em 0 0.5em;
}
.rich h1 {
font-size: 1.45em;
}
.rich h2 {
font-size: 1.25em;
}
.rich h3 {
font-size: 1.1em;
}
.rich p {
margin: 0.6em 0;
}
.rich ul,
.rich ol {
margin: 0.6em 0;
padding-left: 1.4em;
}
.rich li {
margin: 0.2em 0;
}
.rich a {
color: var(--accent-deep);
text-decoration: none;
border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
transition: border-color 0.12s ease;
}
.rich a:hover {
border-bottom-color: var(--accent);
}
.rich code {
font-family: var(--font-code);
font-size: 0.9em;
background: var(--bg-soft);
border: 1px solid var(--line);
border-radius: 5px;
padding: 1px 5px;
}
.rich pre {
background: var(--code-bg);
color: var(--code-ink);
border: 1px solid var(--code-line);
border-radius: var(--radius-sm);
padding: 12px 14px;
overflow-x: auto;
margin: 0.8em 0;
}
.rich pre code {
background: none;
border: none;
padding: 0;
color: inherit;
font-size: 0.86em;
line-height: 1.5;
}
.rich blockquote {
margin: 0.8em 0;
padding: 2px 14px;
border-left: 3px solid var(--accent);
color: var(--ink-soft);
background: var(--bg-soft);
border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.rich table {
border-collapse: collapse;
margin: 0.8em 0;
width: 100%;
font-size: 0.92em;
}
.rich th,
.rich td {
border: 1px solid var(--line-strong);
padding: 6px 10px;
text-align: left;
}
.rich th {
background: var(--bg-soft);
font-weight: 600;
}
.rich tr:nth-child(2n) td {
background: color-mix(in srgb, var(--bg-soft) 55%, transparent);
}
.rich hr {
border: none;
border-top: 1px solid var(--line);
margin: 1.2em 0;
}
/* thinking block (format_llm_response) */
.think-block {
border: 1px solid var(--amber-line);
background: var(--amber-bg);
border-radius: var(--radius);
margin: 0 0 10px;
overflow: hidden;
}
.think-summary {
list-style: none;
cursor: pointer;
padding: 10px 14px;
display: flex;
align-items: center;
gap: 8px;
user-select: none;
}
.think-summary::-webkit-details-marker {
display: none;
}
.think-summary::before {
content: "β–Έ";
color: var(--amber-ink);
transition: transform 0.15s ease;
font-size: 12px;
}
.think-block[open] .think-summary::before {
transform: rotate(90deg);
}
.think-badge {
font-weight: 600;
color: var(--amber-ink);
font-size: 13.5px;
}
.think-hint {
color: var(--ink-faint);
font-size: 11.5px;
margin-left: auto;
}
.think-body {
padding: 2px 16px 12px;
color: var(--ink);
border-top: 1px dashed var(--amber-line);
}
/* final answer block β€” rendered cleanly on plain background without box/card frames */
.final-answer-block {
border: none;
background: transparent;
border-radius: 0;
overflow: visible;
box-shadow: none;
margin: 0;
padding: 0;
}
.answer-header-badge {
display: none;
}
.answer-body {
padding: 0;
}
/* agent step trail (agent_streaming._format_step) */
.agent-step-details {
border: 1px solid var(--line);
background: var(--bg-soft);
border-radius: var(--radius);
margin: 0 0 8px;
overflow: hidden;
}
.agent-step-summary {
list-style: none;
cursor: pointer;
padding: 9px 14px;
display: flex;
align-items: center;
gap: 8px;
font-size: 13.5px;
color: var(--ink-soft);
user-select: none;
}
.agent-step-summary::-webkit-details-marker {
display: none;
}
.agent-step-summary::before {
content: "β–Έ";
color: var(--accent);
font-size: 12px;
transition: transform 0.15s ease;
}
.agent-step-details[open] .agent-step-summary::before {
transform: rotate(90deg);
}
.agent-log-block {
border-top: 1px solid var(--line);
padding: 10px 14px 12px;
font-size: 13.5px;
}
.plan-header,
.tool-header,
.obs-header,
.err-header {
font-weight: 600;
font-size: 12.5px;
margin-bottom: 6px;
letter-spacing: 0.2px;
}
.plan-header {
color: var(--amber-ink);
}
.tool-header {
color: var(--accent-ink);
}
.obs-header {
color: var(--ink-soft);
}
.err-header {
color: var(--err);
}
.agent-plan-box {
background: var(--amber-bg);
border: 1px solid var(--amber-line);
border-radius: var(--radius-sm);
padding: 10px 12px;
margin-bottom: 6px;
}
.agent-thought-box {
background: var(--bg-elev);
border: 1px solid var(--line);
border-radius: var(--radius-sm);
padding: 10px 12px;
margin-bottom: 6px;
}
.agent-tool-box {
background: var(--bg-elev);
border: 1px solid var(--line);
border-left: 3px solid var(--accent);
border-radius: var(--radius-sm);
padding: 10px 12px;
margin-bottom: 6px;
}
.agent-obs-box {
background: var(--code-bg);
color: var(--code-ink);
border-radius: var(--radius-sm);
padding: 10px 12px;
margin-bottom: 6px;
}
.agent-err-box {
background: color-mix(in srgb, var(--err) 9%, var(--bg-elev));
border: 1px solid color-mix(in srgb, var(--err) 35%, var(--line));
border-radius: var(--radius-sm);
padding: 10px 12px;
color: var(--err);
margin-bottom: 6px;
}
.obs-code {
margin: 0;
font-family: var(--font-code);
font-size: 12px;
line-height: 1.5;
white-space: pre-wrap;
word-break: break-word;
color: inherit;
background: none;
border: none;
padding: 0;
}
/* abort banner */
.abort-badge {
display: inline-block;
background: color-mix(in srgb, var(--amber-ink) 12%, transparent);
color: var(--amber-ink);
border: 1px solid var(--amber-line);
border-radius: 999px;
padding: 4px 12px;
font-size: 12.5px;
font-weight: 600;
margin: 8px 0;
}
/* sources */
.sources-block {
border: 1px dashed var(--line-strong);
background: var(--bg-soft);
border-radius: var(--radius-sm);
padding: 10px 14px;
margin: 10px 0 6px;
font-size: 13.5px;
}
/* footer meta line (model id, timing) */
.response-footer {
margin-top: 10px;
padding-top: 8px;
border-top: 1px dashed var(--line);
color: var(--ink-faint);
font-size: 11.5px;
}
/* empty state */
.empty {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
color: var(--ink-faint);
text-align: center;
padding: 0 30px;
}
.empty-mark {
width: 76px;
height: 76px;
border-radius: 26px;
background: linear-gradient(135deg, var(--accent-soft), var(--bg-soft));
border: 1px solid var(--line);
display: flex;
align-items: center;
justify-content: center;
font-size: 34px;
box-shadow: var(--shadow-sm);
}
.empty-title {
color: var(--ink-soft);
font-size: 16px;
font-weight: 600;
}
/* ── Data Analysis chart gallery (backend-appended under the answer) ── */
.chart-gallery {
margin-top: 14px;
padding: 14px;
border: 1px solid var(--line);
border-radius: 14px;
background: var(--bg-soft);
}
.chart-gallery-title {
font-weight: 700;
font-size: 13.5px;
letter-spacing: 0.2px;
color: var(--ink);
margin-bottom: 12px;
}
.chart-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 14px;
}
.chart-card {
margin: 0;
border: 1px solid var(--line);
border-radius: 12px;
overflow: hidden;
background: var(--bg-elev);
box-shadow: var(--shadow-sm);
cursor: zoom-in;
transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.chart-card:hover {
transform: translateY(-2px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.chart-card img {
display: block;
width: 100%;
height: auto;
background: #fff; /* charts are always white-backed */
}
.chart-card figcaption {
padding: 8px 10px;
font-size: 11.5px;
font-weight: 600;
color: var(--ink-soft);
word-break: break-word;
border-top: 1px solid var(--line);
}
/* click-to-zoom lightbox for the chart cards */
.chart-lightbox {
position: fixed;
inset: 0;
z-index: 200;
background: rgba(10, 8, 6, 0.78);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
padding: 34px;
cursor: zoom-out;
animation: lightbox-in 0.14s ease;
}
@keyframes lightbox-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.chart-lightbox img {
max-width: min(92vw, 1280px);
max-height: 80vh;
width: auto;
height: auto;
border-radius: 10px;
box-shadow: 0 14px 60px rgba(0, 0, 0, 0.55);
background: #fff;
cursor: default;
}
.lightbox-caption {
color: rgba(255, 255, 255, 0.92);
font-size: 13.5px;
max-width: 80vw;
text-align: center;
word-break: break-word;
user-select: text;
}
.lightbox-close {
position: absolute;
top: 18px;
right: 22px;
width: 38px;
height: 38px;
border: 1px solid rgba(255, 255, 255, 0.25);
border-radius: 50%;
background: rgba(255, 255, 255, 0.12);
color: #fff;
font-size: 20px;
line-height: 1;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.12s ease, transform 0.08s ease;
}
.lightbox-close:hover {
background: rgba(255, 255, 255, 0.25);
transform: scale(1.06);
}
/* ── Live progress lines (the backend run's real status text) ── */
.run-lines {
margin-top: 8px;
padding-top: 8px;
border-top: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--line));
display: flex;
flex-direction: column;
gap: 3px;
max-height: 150px;
overflow-y: auto;
}
.run-line {
font-family: "Cascadia Code", Consolas, "Courier New", monospace;
font-size: 11.5px;
line-height: 1.5;
color: var(--ink-soft);
white-space: pre-wrap;
word-break: break-all;
user-select: text;
}
/* ── Live answer text (the model's ACTUAL tokens, streamed via `live` WS
events / backend.live_stream). Matches the .rich answer typography so
the growing bubble looks like the final answer being typed. */
.live-text-block {
font-size: 14px;
line-height: 1.45;
color: var(--ink);
white-space: pre-wrap;
word-break: break-word;
user-select: text;
max-width: 760px;
/* A soft warm tint behind the live stream marks it as "in progress"
(like a terminal's output pane), and a gentle breathing glow makes
the running answer feel alive without any layout shift. */
background: color-mix(in srgb, var(--accent) 4%, transparent);
border-radius: 10px;
padding: 8px 12px;
margin: -8px -12px -2px;
animation: live-breathe 2.4s ease-in-out infinite;
}
/* While tokens are streaming, markdown wraps each newline into its own
<p>, so the generic `.rich p` margin (0.6em top + bottom) stacks big
gaps between every line. Keep the live block visually tight β€” only the
finished answer bubble uses the roomier `.rich` spacing. */
.live-text-block p {
margin: 0.15em 0;
}
.live-text-block > :first-child {
margin-top: 0;
}
.live-text-block > :last-child {
margin-bottom: 0;
}
/* The same tightness for every OTHER block element markdown emits while
streaming β€” headings, lists, blockquotes, code, tables, rules β€” so the
live answer doesn't balloon with the roomy `.rich` spacing mid-stream
(only the finished bubble uses that). Mirrors the `.live-text-block p`
override above. */
.live-text-block h1,
.live-text-block h2,
.live-text-block h3,
.live-text-block ul,
.live-text-block ol,
.live-text-block blockquote,
.live-text-block pre,
.live-text-block table,
.live-text-block hr {
margin: 0.25em 0;
}
.live-text-block li {
margin: 0.08em 0;
}
.live-text-block ul,
.live-text-block ol {
padding-left: 1.2em;
}
@keyframes live-breathe {
0%,
100% {
box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent);
}
50% {
box-shadow: 0 0 14px 0 color-mix(in srgb, var(--accent) 22%, transparent);
}
}
/* The compact "⚑ Streaming answer live…" header above the growing tokens
(pulse dot + bilingual label + elapsed timer) β€” reuses the status card's
pulse/timer so the live stream reads as part of the run, not a stray
bubble. */
.live-streaming-head {
display: flex;
align-items: center;
gap: 8px;
margin: 2px 0 6px;
}
.live-streaming-label {
font-size: 12px;
font-weight: 600;
color: var(--accent-ink);
letter-spacing: 0.2px;
}
/* The streaming caret comes from .msg-ai.live .rich::after β€” the live
block carries the `rich` class (for markdown styling), so a second
::after here would render TWO blinking carets. */