demo · v138

Progressive summary

Paste an article and get three summaries at different lengths — short, medium, and long — side by side. Each streams token-by-token via summarizeStreaming(). When the native API is absent a simulated heuristic streams in the same way so the UX shape is still clear.

checking support…

Short

short

Medium

medium

Long

long

the code

const lengths = ['short', 'medium', 'long'];

await Promise.all(lengths.map(async (length) => {
  const summarizer = await Summarizer.create({
    type: 'key-points',
    format: 'plain-text',
    length,
  });

  const output = document.getElementById('out-' + length);
  output.textContent = '';

  for await (const chunk of summarizer.summarizeStreaming(article)) {
    output.textContent += chunk;
  }
}));

see also