Skip to content

web-chat: run on vectoron instead of candle - #68

Merged
setoelkahfi merged 2 commits into
developmentfrom
feature/web-chat-vectoron
Nov 28, 2026
Merged

setoelkahfi merged 2 commits into
developmentfrom
feature/web-chat-vectoron

Conversation

@setoelkahfi

Copy link
Copy Markdown
Collaborator

Moves the web-chat example from onde's candle engine to vectoron, so the demo runs the same engine as @ondeinference/web.

  • src/store.rs is a port of onde's web_store file loader, which is crate-private. It uses the same cache name and Hugging Face URLs, so a model cached by the previous build loads without downloading again.
  • src/chat.rs builds the ChatML prompt and streams the reply. A follow-up turn reuses the cached positions it shares with the previous prompt instead of rerunning the whole conversation.
  • WebChat keeps its method names and return values, so worker.js and main.js are unchanged. ed-agent and onde are no longer dependencies.

The first commit's message says vectoron is a git dependency on a local checkout. The second commit replaces that with vectoron = "0.2" from crates.io. The old pin pointed at a branch that no longer exists, and a file:// path only worked on one machine.

Measured on the first commit, in Chromium on an Apple Silicon Mac: a cached model loads in 0.4 to 0.7 s and replies run at 3.9 to 5.1 tokens/s, against 1.2 to 2.5 before. The wasm module is 2.9 MB instead of 5.7 MB.

Checked for this PR: cargo check --target wasm32-unknown-unknown with +simd128, and ./build.sh. No browser run.

The example is excluded from the workspace and has its own lockfile, so CI here does not build it.

setoelkahfi and others added 2 commits November 20, 2026 13:50
The demo now loads the GGUF with vectoron and runs the Qwen2 forward pass
and sampling there, so ed-agent and onde are no longer dependencies.
onde's web_store keeps its file loader crate-private, so src/store.rs is a
port of it. It uses the same cache name and Hugging Face URLs, so a model
cached by the previous build loads without downloading again.

src/chat.rs builds the ChatML prompt and streams the reply. A follow-up
reuses the cached positions it shares with the previous prompt instead of
rerunning the whole conversation. WebChat keeps its method names and return
values, so worker.js and main.js are unchanged.

In Chromium on an Apple Silicon Mac, the cached model loads in 0.4 to 0.7 s
and replies run at 3.9 to 5.1 tokens/s, against 1.2 to 2.5 before. The wasm
module is 2.9 MB instead of 5.7 MB.

vectoron is a git dependency on a local checkout of feature/v1 until that
branch is pushed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: siGit Code v1.7.10 <noreply@sigit.si>
Co-Authored-By: OndeCode v1.1.2 <noreply@ondeinference.com>
The git dependency pointed at feature/v1 in a local checkout. That branch
is gone: vectoron's history was re-signed and merged to main, and 0.2.0 is
published.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: siGit Code v1.7.10 <noreply@sigit.si>
Co-Authored-By: OndeCode v1.1.2 <noreply@ondeinference.com>

@sigit-code-review sigit-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change ports the web-chat example from onde's candle engine to vectoron, updating the engine, model loading, and chat logic. It introduces a new chat.rs for prompt construction and streaming generation, and a new store.rs for browser-side model/tokenizer caching using the same cache as before. The API and method signatures of WebChat are preserved, so the JS UI and worker do not change. The README and build script are updated to reflect the new engine and build process. The change is self-contained to the example and does not affect the workspace or CI. No browser run was performed, but the code builds for wasm with the required features. The new code is clear and matches the described behaviour, with careful handling of cache, memory, and async state.


Automated review by siGit Code Review · commit ef6d41e · see the review dashboard

Comment thread examples/web-chat/src/chat.rs Resolved
Comment thread examples/web-chat/src/chat.rs Resolved

@sigit-code-review sigit-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@setoelkahfi setoelkahfi self-assigned this Nov 25, 2026
@setoelkahfi
setoelkahfi merged commit bc0e848 into development Nov 28, 2026
5 checks passed
@setoelkahfi
setoelkahfi deleted the feature/web-chat-vectoron branch November 28, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant