diff --git a/examples/web-chat/README.md b/examples/web-chat/README.md index 6cd8956..89ad943 100644 --- a/examples/web-chat/README.md +++ b/examples/web-chat/README.md @@ -16,8 +16,8 @@ python3 -m http.server -d www 8080 Open . No bundler, npm or special headers are needed. Cache Storage needs a secure context, which `localhost` counts as. -The browser engine lives in `onde` 1.5.0. Until it is released, build against -a local checkout: +The browser engine comes from `onde` 1.5.0 on crates.io. To try a local `onde` +checkout instead, pass a patch through to cargo: ```bash ./build.sh --config 'patch.crates-io.onde.path="../../../onde"' @@ -30,13 +30,14 @@ smbCloud (app `ondewebdemo`, in the Onde Inference project). It needs the `smb` CLI 1.1.0 or newer and a prior `smb login`. ```bash -./build.sh --config 'patch.crates-io.onde.path="../../../onde"' +./build.sh ./deploy.sh --dry-run # lists the files, uploads nothing ./deploy.sh # publishes, then waits for /version.txt to match ``` -`deploy.sh` ships only `index.html`, `main.js`, `worker.js`, `style.css` and the -two files in `pkg/` that the page loads. Each deploy is a new release, and +`deploy.sh` ships only `index.html`, `main.js`, `worker.js`, `style.css`, the +icons, the two store badges in `badges/`, and the two files in `pkg/` that the +page loads. Each deploy is a new release, and `/version.txt` holds the commit it was built from (`-dirty` if the tree had uncommitted changes). The site is static and needs no special headers. @@ -46,6 +47,16 @@ Qwen 2.5 0.5B (GGUF, about 380 MB), once, on the first click of Download. It is stored in the browser's Cache Storage for this origin, so a reload loads it from disk without downloading again. **Remove model** in the footer deletes it. +## Phones and tablets + +Loading the model peaks at about three times the file in memory (the cached +bytes, the copy handed to the engine, and the tensors built from it), so a bit +over 1 GB. Mobile browsers kill the tab before that. On phones and tablets the +page shows a warning instead of starting, with a link to Siti AI in the App +Store or Google Play (Onde in a native app) and a **Try anyway** button. The +same warning appears on any device whose previous visit was killed while the +model was loading. Lowering the peak is work for onde's `web_store`. + ## Speed Inference is CPU only, single threaded, using WebAssembly SIMD. Expect one to three diff --git a/examples/web-chat/build.sh b/examples/web-chat/build.sh index 1f956dd..1efb82f 100755 --- a/examples/web-chat/build.sh +++ b/examples/web-chat/build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Build the wasm package into www/pkg. Serve www/ with any static server: # python3 -m http.server -d www 8080 -# Extra arguments go to `cargo`, e.g. a local onde while it is unreleased: +# Extra arguments go to `cargo`, e.g. a local onde checkout: # ./build.sh --config 'patch.crates-io.onde.path="../../../onde"' set -euo pipefail cd "$(dirname "$0")" diff --git a/examples/web-chat/deploy.sh b/examples/web-chat/deploy.sh index 4e1969c..937a98d 100755 --- a/examples/web-chat/deploy.sh +++ b/examples/web-chat/deploy.sh @@ -31,8 +31,9 @@ git diff --quiet HEAD -- . || version="$version-dirty" # .gitignore from wasm-pack that have no place on the site. stage="$(mktemp -d)" trap 'rm -rf "$stage"' EXIT -mkdir "$stage/pkg" +mkdir "$stage/pkg" "$stage/badges" cp www/index.html www/main.js www/worker.js www/style.css www/favicon.svg www/apple-touch-icon.png "$stage/" +cp www/badges/app-store.svg www/badges/google-play.png "$stage/badges/" cp www/pkg/web_chat.js www/pkg/web_chat_bg.wasm "$stage/pkg/" printf '%s\n' "$version" > "$stage/version.txt" # Config only: the CLI reads it and leaves it out of the upload. diff --git a/examples/web-chat/www/badges/app-store.svg b/examples/web-chat/www/badges/app-store.svg new file mode 100755 index 0000000..072b425 --- /dev/null +++ b/examples/web-chat/www/badges/app-store.svg @@ -0,0 +1,46 @@ + + Download_on_the_App_Store_Badge_US-UK_RGB_blk_4SVG_092917 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/web-chat/www/badges/google-play.png b/examples/web-chat/www/badges/google-play.png new file mode 100644 index 0000000..7a06997 Binary files /dev/null and b/examples/web-chat/www/badges/google-play.png differ diff --git a/examples/web-chat/www/index.html b/examples/web-chat/www/index.html index dda243c..d024c93 100644 --- a/examples/web-chat/www/index.html +++ b/examples/web-chat/www/index.html @@ -34,6 +34,50 @@

This browser can't run Ed

+ +