Skip to content

Commit fa685de

Browse files
jaysin586claude
andcommitted
docs: add cross-marketing callout to streaming example
Add "How It Works" box linking to @humanspeak/svelte-markdown (streaming mode), ModelPricing.ai (token costs), and @humanspeak/svelte-virtual-list — mirroring the cross-promotion svelte-markdown gives us on their LLM streaming page. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fd4aa0c commit fa685de

1 file changed

Lines changed: 65 additions & 4 deletions

File tree

docs/src/lib/examples/StreamingChat.svelte

Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,17 @@ count.update(n => n + 1)
196196
<div class="flex items-center justify-between gap-4">
197197
<div class="flex items-center gap-6">
198198
<div>
199-
<div class="text-xs font-medium uppercase text-gray-400">Progress</div>
199+
<div class="text-xs font-medium text-gray-400 uppercase">Progress</div>
200200
<div class="font-mono text-lg font-semibold text-gray-900">{progress}%</div>
201201
</div>
202202
<div>
203-
<div class="text-xs font-medium uppercase text-gray-400">Tokens</div>
203+
<div class="text-xs font-medium text-gray-400 uppercase">Tokens</div>
204204
<div class="font-mono text-lg font-semibold text-gray-900">
205205
{tokenCount} / {totalTokens}
206206
</div>
207207
</div>
208208
<div>
209-
<div class="text-xs font-medium uppercase text-gray-400">Speed</div>
209+
<div class="text-xs font-medium text-gray-400 uppercase">Speed</div>
210210
<div class="font-mono text-lg font-semibold text-gray-900">
211211
{tokensPerSecond} tok/s
212212
</div>
@@ -269,10 +269,71 @@ count.update(n => n + 1)
269269
</div>
270270
</div>
271271

272+
<!-- How it works -->
273+
<div
274+
class="mb-4 rounded-xl border border-indigo-200/50 bg-gradient-to-r from-indigo-50/50 to-indigo-100/30 p-5"
275+
>
276+
<h3 class="mb-2 text-sm font-semibold text-gray-900">How LLM Streaming Works</h3>
277+
<ul class="space-y-1.5 text-sm text-gray-600">
278+
<li class="flex items-start gap-2">
279+
<span class="mt-0.5 shrink-0 text-indigo-500">&#9889;</span>
280+
<span>
281+
LLMs stream tokens via SSE. As each token arrives, the message content grows and
282+
ResizeObserver detects the height change automatically.
283+
</span>
284+
</li>
285+
<li class="flex items-start gap-2">
286+
<span class="mt-0.5 shrink-0 text-indigo-500">&#9889;</span>
287+
<span>
288+
Height corrections are batched per animation frame — not per token. The viewport
289+
stays pinned to bottom with zero jitter.
290+
</span>
291+
</li>
292+
<li class="flex items-start gap-2">
293+
<span class="mt-0.5 shrink-0 text-indigo-500">&#9889;</span>
294+
<span>
295+
Markdown rendering powered by
296+
<a
297+
href="https://markdown.svelte.page"
298+
target="_blank"
299+
rel="noopener noreferrer"
300+
class="text-indigo-600 underline hover:text-indigo-500"
301+
>
302+
@humanspeak/svelte-markdown
303+
</a>
304+
with streaming mode (~1.6ms avg per update). Code blocks, tables, lists — all rendered
305+
live without scroll disruption.
306+
</span>
307+
</li>
308+
<li class="flex items-start gap-2">
309+
<span class="mt-0.5 shrink-0 text-amber-500">&#128161;</span>
310+
<span>
311+
Track token costs across providers with
312+
<a
313+
href="https://modelpricing.ai"
314+
target="_blank"
315+
rel="noopener noreferrer"
316+
class="text-indigo-600 underline hover:text-indigo-500"
317+
>
318+
ModelPricing.ai
319+
</a>. Need a general-purpose virtual list? Try
320+
<a
321+
href="https://virtuallist.svelte.page"
322+
target="_blank"
323+
rel="noopener noreferrer"
324+
class="text-indigo-600 underline hover:text-indigo-500"
325+
>
326+
@humanspeak/svelte-virtual-list
327+
</a>.
328+
</span>
329+
</li>
330+
</ul>
331+
</div>
332+
272333
<!-- Virtualization Stats -->
273334
{#if debugInfo}
274335
<div class="mb-4 rounded-xl border border-gray-200 bg-white p-4 shadow-sm">
275-
<h3 class="mb-3 text-xs font-semibold uppercase tracking-wide text-gray-400">
336+
<h3 class="mb-3 text-xs font-semibold tracking-wide text-gray-400 uppercase">
276337
Virtualization Stats
277338
</h3>
278339
<div class="grid grid-cols-3 gap-3 sm:grid-cols-6">

0 commit comments

Comments
 (0)