booper-chat / static /index.html
ProCreations's picture
booper-chat: streaming chat UI over the 34M Discord model
086024b verified
Raw History Blame Contribute Delete
16.5 kB
<!doctype html>
<html lang="en" data-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="color-scheme" content="dark">
<meta name="theme-color" content="#08090d">
<title>booper-chat</title>
<meta name="description" content="Chat with booper-chat, a 34M-parameter transformer trained on Discord conversations.">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>%F0%9F%91%80</text></svg>">
<style>
/* ---------- tokens ---------- */
:root{
--bg:#08090d; --bg-2:#0d0f16; --surface:#12141d; --surface-2:#171a25;
--line:rgba(255,255,255,.07); --line-2:rgba(255,255,255,.12);
--ink:#e8eaf2; --ink-2:#a2a7bb; --ink-3:#666d84;
--accent:#7c8cff; --accent-2:#5ee6c4; --accent-ink:#0a0b10;
--danger:#ff6b81;
--r-lg:20px; --r-md:14px; --r-sm:10px;
--shell:min(820px,100%);
--font:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,"Helvetica Neue",Arial,sans-serif;
--mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
margin:0; background:var(--bg); color:var(--ink); font-family:var(--font);
font-size:16px; line-height:1.5; -webkit-font-smoothing:antialiased;
overscroll-behavior:none;
}
/* the glow behind everything — one paint, no animation cost while streaming */
body::before{
content:""; position:fixed; inset:0; pointer-events:none; z-index:0;
background:
radial-gradient(760px 420px at 18% -8%, rgba(124,140,255,.16), transparent 65%),
radial-gradient(620px 380px at 88% 4%, rgba(94,230,196,.09), transparent 62%);
}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
button:focus-visible,textarea:focus-visible,input:focus-visible,a:focus-visible{
outline:2px solid var(--accent); outline-offset:2px; border-radius:6px;
}
/* ---------- shell ---------- */
.app{
position:relative; z-index:1; height:100dvh; display:grid;
/* minmax(0,…) on both axes: grid items default to min-width:auto, and the
header's nowrap model line is wide enough to push the whole column past
the viewport on a phone if it is allowed to. */
grid-template-rows:auto minmax(0,1fr) auto; grid-template-columns:minmax(0,1fr);
}
header,main,footer{min-width:0}
@supports not (height:100dvh){ .app{height:100vh} }
/* ---------- header ---------- */
header{
display:flex; align-items:center; gap:12px;
padding:calc(env(safe-area-inset-top) + 12px) 16px 12px;
border-bottom:1px solid var(--line);
background:rgba(8,9,13,.72); backdrop-filter:blur(14px);
}
.wrap{width:var(--shell);margin-inline:auto;padding-inline:16px}
header .wrap{display:flex;align-items:center;gap:12px}
.mark{display:flex;align-items:center;gap:10px;min-width:0}
.eyes{
width:34px;height:34px;flex:none;border-radius:11px;
background:linear-gradient(150deg,var(--accent),var(--accent-2));
display:grid;place-items:center;font-size:17px;line-height:1;
box-shadow:0 0 0 1px rgba(255,255,255,.12),0 6px 20px -6px rgba(124,140,255,.7);
}
.title{display:flex;flex-direction:column;min-width:0}
.title b{font-size:15px;font-weight:650;letter-spacing:-.01em}
.title a{
font-size:11.5px;color:var(--ink-3);text-decoration:none;font-family:var(--mono);
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.title a:hover{color:var(--accent-2)}
.spacer{flex:1}
/* context ring: the 1024-token window, visibly filling up */
.ctx{display:flex;align-items:center;gap:8px}
.ctx svg{display:block;transform:rotate(-90deg)}
.ctx .track{stroke:var(--line-2)}
.ctx .fill{stroke:var(--accent-2);transition:stroke-dashoffset .35s ease,stroke .35s ease}
.ctx.warm .fill{stroke:#ffb86b}
.ctx.full .fill{stroke:var(--danger)}
.ctx-num{font-family:var(--mono);font-size:11px;color:var(--ink-3);text-align:right;line-height:1.25}
@media (max-width:400px){ .ctx-num{display:none} }
.ctx-num b{display:block;color:var(--ink-2);font-weight:600}
.icon-btn{
width:36px;height:36px;flex:none;border-radius:11px;display:grid;place-items:center;
border:1px solid var(--line); color:var(--ink-2); background:var(--surface);
transition:background .15s,color .15s,border-color .15s;
}
.icon-btn:hover{background:var(--surface-2);color:var(--ink);border-color:var(--line-2)}
.icon-btn[aria-pressed="true"]{color:var(--accent-ink);background:var(--accent-2);border-color:transparent}
/* ---------- messages ---------- */
main{overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-width:thin;
scrollbar-color:var(--line-2) transparent}
main::-webkit-scrollbar{width:8px}
main::-webkit-scrollbar-thumb{background:var(--line-2);border-radius:99px}
.thread{width:var(--shell);max-width:100%;margin-inline:auto;padding:22px 16px 8px;
min-height:100%;display:flex;flex-direction:column;gap:14px}
/* Short conversations sit on the composer the way a chat app's do. margin-top
on the first message rather than justify-content:flex-end, which clips the
top of the list once it overflows its scroll container. */
.msg:first-of-type{margin-top:auto}
.msg{display:flex;flex-direction:column;max-width:min(78%,600px);animation:rise .22s ease both}
@keyframes rise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.msg{animation:none}}
.msg.user{align-self:flex-end;align-items:flex-end}
.msg.bot{align-self:flex-start;align-items:flex-start}
.bubble{
padding:11px 15px;border-radius:var(--r-lg);white-space:pre-wrap;word-wrap:break-word;
overflow-wrap:anywhere;font-size:15.5px;
}
.user .bubble{
background:linear-gradient(160deg,var(--accent),#6472f0);color:#fff;
border-bottom-right-radius:7px;box-shadow:0 8px 24px -12px rgba(124,140,255,.9);
}
.bot .bubble{
background:var(--surface);border:1px solid var(--line);border-bottom-left-radius:7px;
}
.bot .bubble.err{border-color:rgba(255,107,129,.35);color:#ffc2cb}
.meta{
font-family:var(--mono);font-size:10.5px;color:var(--ink-3);margin:5px 4px 0;
display:flex;gap:9px;align-items:center;flex-wrap:wrap;
}
.meta button{color:var(--ink-3);text-decoration:underline;text-underline-offset:2px}
.meta button:hover{color:var(--accent-2)}
/* caret while tokens are still arriving */
.streaming .bubble::after{
content:"";display:inline-block;width:.5em;height:1.02em;margin-left:2px;
vertical-align:-.18em;background:var(--accent-2);border-radius:1px;animation:blink 1s steps(2,end) infinite;
}
@keyframes blink{50%{opacity:0}}
.dots{display:inline-flex;gap:4px;padding:3px 2px}
.dots i{width:6px;height:6px;border-radius:50%;background:var(--ink-3);animation:bob 1.1s ease-in-out infinite}
.dots i:nth-child(2){animation-delay:.15s}.dots i:nth-child(3){animation-delay:.3s}
@keyframes bob{0%,60%,100%{opacity:.28;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}
/* ---------- empty state ---------- */
/* margin-block:auto centres the empty state in the column, so a tall phone
does not open on a screenful of nothing under the greeting. */
.hello{margin-block:auto;padding:24px 0;text-align:center;animation:rise .3s ease both}
.hello h1{margin:0 0 8px;font-size:clamp(24px,6vw,32px);letter-spacing:-.03em;font-weight:680}
.hello h1 span{background:linear-gradient(100deg,var(--accent),var(--accent-2));
-webkit-background-clip:text;background-clip:text;color:transparent}
.hello p{margin:0 auto;max-width:46ch;color:var(--ink-2);font-size:14.5px}
.chips{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:20px}
.chip{
padding:9px 15px;border-radius:99px;border:1px solid var(--line-2);background:var(--surface);
color:var(--ink-2);font-size:14px;transition:transform .12s,border-color .15s,color .15s,background .15s;
}
.chip:hover{color:var(--ink);border-color:var(--accent);background:var(--surface-2);transform:translateY(-1px)}
.facts{display:flex;flex-wrap:wrap;gap:6px 16px;justify-content:center;margin-top:26px;
font-family:var(--mono);font-size:11px;color:var(--ink-3)}
.facts b{color:var(--ink-2);font-weight:600}
/* ---------- composer ---------- */
footer{
border-top:1px solid var(--line);background:rgba(8,9,13,.82);backdrop-filter:blur(14px);
padding-bottom:env(safe-area-inset-bottom);
}
footer .wrap{padding-block:12px}
.composer{display:flex;align-items:flex-end;gap:9px;
background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r-lg);
padding:7px 7px 7px 15px;transition:border-color .18s,box-shadow .18s}
.composer:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px rgba(124,140,255,.16)}
#input{
flex:1;min-width:0;border:0;background:none;color:var(--ink);resize:none;outline:none;
font:inherit;font-size:16px;line-height:1.45;max-height:34vh;padding:6px 0;
}
#input::placeholder{color:var(--ink-3)}
#send{
width:38px;height:38px;flex:none;border-radius:12px;display:grid;place-items:center;
background:linear-gradient(150deg,var(--accent),var(--accent-2));color:var(--accent-ink);
transition:opacity .15s,transform .12s;
}
#send:hover:not(:disabled){transform:translateY(-1px)}
#send:disabled{opacity:.32;cursor:not-allowed;transform:none}
#send.stop{background:var(--danger);color:#fff}
.hint{margin:8px 2px 0;font-family:var(--mono);font-size:10.5px;color:var(--ink-3);
display:flex;gap:12px;align-items:center;justify-content:space-between;min-width:0}
.hint span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hint .keys{display:none}
.hint #speed{flex:none}
@media (hover:hover) and (pointer:fine){.hint .keys{display:inline}}
/* ---------- settings ---------- */
.sheet{
position:fixed;inset:0;z-index:20;display:none;
background:rgba(4,5,8,.62);backdrop-filter:blur(3px);
}
.sheet[open],.sheet.open{display:block}
.sheet-card{
position:absolute;left:50%;bottom:0;transform:translateX(-50%);
width:min(520px,100%);max-height:86dvh;overflow-y:auto;
background:var(--bg-2);border:1px solid var(--line-2);border-bottom:0;
border-radius:22px 22px 0 0;padding:18px 20px calc(env(safe-area-inset-bottom) + 22px);
animation:up .22s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes up{from{transform:translate(-50%,16px);opacity:0}to{transform:translate(-50%,0);opacity:1}}
@media (min-width:640px){
.sheet-card{top:50%;bottom:auto;transform:translate(-50%,-50%);border-radius:20px;border-bottom:1px solid var(--line-2);
padding-bottom:22px;animation:none}
}
.sheet-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}
.sheet-head h2{margin:0;font-size:16px;font-weight:650;letter-spacing:-.01em}
.sheet p.sub{margin:0 0 16px;font-size:12.5px;color:var(--ink-3)}
.row{padding:11px 0;border-top:1px solid var(--line)}
.row label{display:flex;justify-content:space-between;align-items:baseline;gap:12px;font-size:13.5px;color:var(--ink-2)}
.row label output{font-family:var(--mono);font-size:12px;color:var(--accent-2)}
.row small{display:block;color:var(--ink-3);font-size:11.5px;margin-top:3px;line-height:1.4}
input[type=range]{
-webkit-appearance:none;appearance:none;width:100%;height:22px;background:none;margin-top:6px;
}
input[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:99px;background:var(--line-2)}
input[type=range]::-moz-range-track{height:4px;border-radius:99px;background:var(--line-2)}
input[type=range]::-webkit-slider-thumb{
-webkit-appearance:none;width:18px;height:18px;margin-top:-7px;border-radius:50%;
background:var(--accent-2);box-shadow:0 0 0 3px rgba(94,230,196,.18);cursor:grab;
}
input[type=range]::-moz-range-thumb{width:18px;height:18px;border:0;border-radius:50%;
background:var(--accent-2);box-shadow:0 0 0 3px rgba(94,230,196,.18);cursor:grab}
.sheet-foot{display:flex;gap:10px;margin-top:18px}
.btn{flex:1;padding:11px;border-radius:var(--r-md);border:1px solid var(--line-2);
background:var(--surface);font-size:14px;color:var(--ink-2);transition:background .15s,color .15s}
.btn:hover{background:var(--surface-2);color:var(--ink)}
.btn.primary{background:var(--accent-2);color:var(--accent-ink);border-color:transparent;font-weight:600}
.btn.primary:hover{filter:brightness(1.07);color:var(--accent-ink)}
.sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
</style>
</head>
<body>
<div class="app">
<header>
<div class="wrap">
<div class="mark">
<div class="eyes" aria-hidden="true">👀</div>
<div class="title">
<b>booper-chat</b>
<a href="https://huggingface.co/ProCreations/booper-chat" target="_blank" rel="noopener"
id="sub">34.1M · 1024 ctx</a>
</div>
</div>
<div class="spacer"></div>
<div class="ctx" id="ctx" title="context window used">
<svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true">
<circle class="track" cx="15" cy="15" r="12" fill="none" stroke-width="3"/>
<circle class="fill" id="ctxFill" cx="15" cy="15" r="12" fill="none" stroke-width="3"
stroke-linecap="round" stroke-dasharray="75.4" stroke-dashoffset="75.4"/>
</svg>
<div class="ctx-num"><b id="ctxUsed">0</b>/1024</div>
</div>
<button class="icon-btn" id="newChat" title="New chat" aria-label="New chat">
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M5 12h14"/></svg>
</button>
<button class="icon-btn" id="gear" title="Sampling settings" aria-label="Sampling settings">
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h10M18 6h2M4 12h2M10 12h10M4 18h10M18 18h2"/>
<circle cx="16" cy="6" r="2"/><circle cx="8" cy="12" r="2"/><circle cx="16" cy="18" r="2"/></svg>
</button>
</div>
</header>
<main id="scroll">
<div class="thread" id="thread">
<div class="hello" id="hello">
<h1>talk to <span>booper</span></h1>
<p>A 34-million-parameter transformer that was pretrained on web text and then
fine-tuned on Discord threads. It is very small and very confident. Say hi.</p>
<div class="chips" id="chips">
<button class="chip">hey</button>
<button class="chip">what's up</button>
<button class="chip">lol</button>
<button class="chip">can you help me</button>
<button class="chip">are you a bot</button>
</div>
<div class="facts">
<span><b>8</b> layers</span><span><b>512</b> wide</span><span><b>16k</b> vocab</span>
<span><b>1024</b> token window</span><span id="backendFact"><b>CPU</b> inference</span>
</div>
</div>
</div>
</main>
<footer>
<div class="wrap">
<div class="composer">
<label class="sr" for="input">Message booper</label>
<textarea id="input" rows="1" placeholder="Message booper…" autocomplete="off"
autocapitalize="sentences" spellcheck="true" enterkeyhint="send"></textarea>
<button id="send" title="Send" aria-label="Send">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"
stroke-linecap="round" stroke-linejoin="round"><path d="M12 19V5M5 12l7-7 7 7"/></svg>
</button>
</div>
<div class="hint">
<span class="keys">Enter to send · Shift+Enter for a new line</span>
<span id="speed"></span>
</div>
</div>
</footer>
</div>
<div class="sheet" id="sheet" role="dialog" aria-modal="true" aria-labelledby="sheetTitle">
<div class="sheet-card" id="sheetCard">
<div class="sheet-head">
<h2 id="sheetTitle">Sampling</h2>
<button class="icon-btn" id="closeSheet" aria-label="Close">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round"><path d="M18 6 6 18M6 6l12 12"/></svg>
</button>
</div>
<p class="sub">Defaults are the ones booper actually ships with.</p>
<div id="knobs"></div>
<div class="sheet-foot">
<button class="btn" id="resetKnobs">Reset</button>
<button class="btn primary" id="doneKnobs">Done</button>
</div>
</div>
</div>
<script src="/app.js"></script>
</body>
</html>