Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions suites-experimental/chat-stream/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
69 changes: 69 additions & 0 deletions suites-experimental/chat-stream/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# ChatStream

An LLM chat client: a sidebar of conversations, a message list, and a
composer, with assistant replies streamed in a few tokens at a time and
rendered as Markdown. It is written in Octane (`octane/App.tsrx`,
ChatStream-Octane). The corpus, Markdown parser, network stub and stylesheet
are in `shared/`.

It is an original app and ships no third-party assets. It is adapted from the
`chat-stream` benchmark in the Octane repository, with Markdown replies, code
highlighting and scroll pinning added.

## What are we testing

- Streaming: chunks append to the reply's text, and rendering re-parses the
reply's Markdown. Unchanged blocks keep their identity across parses (the
memoized-Markdown pattern streaming chat UIs use), so `memo` skips all but
the blocks that grew.
- Code blocks highlighted into one span per token, the way chat UIs' regex
highlighters produce them.
- Scroll pinning with CSS scroll anchoring: an anchor element after the
messages (the list's only `overflow-anchor: auto` candidate) keeps the
newest text in view as replies grow and conversations switch. The browser
adjusts the scroll position during its own layout, so no script reads
layout after a commit.
- Mounting and unmounting whole conversations, up to 200 messages.
- A controlled composer updated on every keystroke.

## How are we testing

All content comes from one fixed seed in `shared/corpus.js`. There is no network,
storage, `Math.random` or `Date.now`, so every run renders the same
conversations and streams the same replies.

`shared/network.js` stands in for a streaming fetch. Each `window.deliverChunk()`
call hands the open reply its next four tokens, so chunk arrival is
deterministic and needs no timers.

The app commits the way the Octane fixture of the chat-stream benchmark in the
Octane repository does. Its event handlers only set state, and the steps commit
it through `window.__benchFlush` after every interaction, as that benchmark's
`run.mjs` does. Each chunk renders with `flushSync`, since a chunk arrives
outside any event. So each send, chunk, conversation click and keystroke is on
screen before the step's next interaction. A step stops delivering chunks once
the reply loses its `streaming` class (see `chatStreamTests` in
`suites-experimental/suites.mjs`). No step yields to the event loop before it
ends, so every browser paints once per step.

- `StreamReplies`: sends three prompts in turn in the first conversation,
streaming each reply to completion before sending the next.
- `SwitchConversations`: clicks every conversation in the sidebar, then returns
to the first.
- `StreamIntoLongConversation`: streams one reply at the end of the
200-message conversation.
- `TypePrompt`: types a 163-character prompt into the composer one character
at a time.

The composer uses `onInput`, which fires for every input event, including the
ones the benchmark dispatches after setting the value from script.

## Developer Documentation

The app is built with Vite. It can be previewed during development with
`npm run dev`. To update the files run in the harness, run `npm run build`,
which regenerates the committed `dist/octane` directory and its
`resources.txt`.

The built workload can be loaded within the harness at e.g.
`http://localhost:8080/?developerMode&suites=ChatStream-Octane`.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions suites-experimental/chat-stream/dist/octane/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ChatStream-Octane</title>
<script type="module" crossorigin src="./assets/index-DZAT5HXC.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-DEIczM35.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"version": 1,
"buildId": "EB1lFTf1277xlXhJ",
"mode": "production",
"capabilities": {
"independentHydration": false
}
}
5 changes: 5 additions & 0 deletions suites-experimental/chat-stream/dist/octane/resources.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
assets/index-DEIczM35.css
assets/index-DZAT5HXC.js
assets/index-DZAT5HXC.js.map
index.html
octane-client-build.json
Loading