cite-demo / index.html
cjdd3b's picture
Add model switch: Cite 32M (default) / Cite 68M
a2d7085 verified
Raw History Blame Contribute Delete
7.79 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Cite</title>
<style>
:root {
--canvas: #f7f7f5; --paper: #ffffff; --ink: #171817; --muted: #747873;
--line: #dedfdb; --line-strong: #c9cbc6; --soft: #f0f1ee;
--accent: #1d6751; --accent-soft: #e4f2ed;
--danger: #a7433d;
--code: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
--sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box }
html, body { height: 100% }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 14px/1.45 var(--sans) }
button, textarea, input { font: inherit }
button { cursor: pointer }
.shell { height: 100vh; display: grid; grid-template-columns: minmax(480px, 1fr) minmax(420px, 46vw) }
.workspace { min-width: 0; display: grid; grid-template-rows: 58px 1fr auto; background: var(--paper) }
.topbar { border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 16px }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 760; letter-spacing: -.01em }
.mark { width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 7px; font: 700 13px var(--code) }
.meta { color: var(--muted); font: 12px var(--code) }
.button { border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); border-radius: 7px; padding: 7px 11px; font-weight: 620 }
.button:hover { background: var(--soft) }
.button.primary { color: white; border-color: var(--accent); background: var(--accent) }
.button.primary:hover { background: #165441 }
.button:disabled { opacity: .55; cursor: wait }
.article-pane { min-height: 0; display: grid; grid-template-rows: 42px 1fr }
.pane-head { border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 14px }
.pane-title { font-weight: 680 }
.pane-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px }
.text-button { border: 0; background: transparent; color: var(--accent); padding: 3px; font-weight: 640 }
textarea.article {
width: 100%; height: 100%; resize: none; display: block; border: 0; outline: 0;
color: #2f3430; background: #fbfbfa; padding: 16px 18px; font: 14px/1.6 var(--sans);
}
textarea.article:focus { box-shadow: inset 3px 0 var(--accent) }
.askbar { border-top: 1px solid var(--line); padding: 12px 14px; display: grid; gap: 8px }
.ask-row { display: flex; gap: 8px }
.ask-row input {
flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 7px;
padding: 8px 11px; outline: 0; background: var(--paper);
}
.ask-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft) }
.hint { color: var(--muted); font-size: 12px }
.error { color: var(--danger) }
.shell { min-height: 0 }
.response {
min-width: 0; min-height: 0; height: 100vh; overflow: hidden;
border-left: 1px solid var(--line); background: var(--paper);
display: grid; grid-template-rows: 58px 1fr;
}
.response-head { border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 18px }
.response-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 750 }
.response-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0 }
.pager { display: none; align-items: center; gap: 6px }
.pager.visible { display: flex }
.pager-label { color: var(--muted); font: 12px var(--code); min-width: 4.5em; text-align: center }
.pager .button { padding: 5px 9px }
.response-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px }
.empty { height: 100%; display: grid; place-items: center; color: var(--muted); text-align: center }
.empty strong { display: block; color: #555a55; font-size: 18px; margin-bottom: 5px }
.result-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden }
.result-head { padding: 13px 14px; background: #fafaf8; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: baseline }
.question { font-weight: 650 }
.topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0 }
.model-select {
font: 12px var(--code); color: var(--ink, #2a2f2c); background: transparent;
border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; cursor: pointer;
}
.model-select:disabled { opacity: .6; cursor: progress }
.result-main { padding: 14px 14px 16px }
.heat-para {
margin: 0 0 10px; padding: 10px 12px; border-radius: 8px;
font: 14px/1.55 var(--sans); color: #2a2f2c;
}
.heat-para:last-child { margin-bottom: 0 }
.heat-meta { margin-top: 6px; color: var(--muted); font: 11px var(--code) }
.heat-cut { opacity: .55 }
@media (max-width: 900px) { .shell { display: block; height: auto } .workspace { height: 80vh } .response { min-height: 70vh; border-left: 0; border-top: 1px solid var(--line) } }
</style>
</head>
<body>
<div class="shell">
<main class="workspace">
<div class="topbar">
<div class="brand"><span class="mark">C</span><span>Cite</span></div>
<div class="topbar-right">
<select id="model" class="model-select" aria-label="Model size" onchange="switchModel(this.value)">
<option value="32m">Cite 32M · fast · 36 MB</option>
<option value="68m">Cite 68M · more accurate · 88 MB</option>
</select>
<div class="meta" id="info">loading model…</div>
</div>
</div>
<section class="article-pane">
<div class="pane-head">
<div class="pane-title">Article</div>
<div class="pane-meta">
<span id="paragraph-count"></span>
<button class="text-button" onclick="resetExample()">Example</button>
<button class="text-button" onclick="clearArticle()">Clear</button>
</div>
</div>
<textarea id="article" class="article" spellcheck="false" aria-label="Article text"
placeholder="Paste an article. Separate paragraphs with blank lines."></textarea>
</section>
<div class="askbar">
<div class="ask-row">
<input id="question" placeholder="Ask a question about the article…" aria-label="Question">
<button id="ask" class="button primary" onclick="ask()">Ask <span aria-hidden="true">↵</span></button>
</div>
<div id="status" class="hint">Downloading Cite for the browser…</div>
</div>
</main>
<aside class="response">
<div class="response-head">
<div class="response-title">Scored article</div>
<div class="response-tools">
<div class="pager" id="pager">
<button type="button" class="button" id="pager-prev" onclick="showOlder()" aria-label="Older result">←</button>
<span class="pager-label" id="pager-label"></span>
<button type="button" class="button" id="pager-next" onclick="showNewer()" aria-label="Newer result">→</button>
</div>
<div class="meta" id="latency"></div>
</div>
</div>
<div class="response-body" id="results">
<div class="empty"><div><strong>No questions yet</strong>Paste an article and ask a question.</div></div>
</div>
</aside>
</div>
<script type="module" src="./main.js"></script>
</body>
</html>