From 6ae399df720d692cb44f1ca9c8fc0b5476ed358d Mon Sep 17 00:00:00 2001 From: Seto Elkahfi <1797197+setoelkahfi@users.noreply.github.com> Date: Wed, 18 Nov 2026 16:30:03 +0100 Subject: [PATCH 1/2] web-chat: warn phones and tablets before loading the model Loading the model peaks at about three times the 380 MB file in memory, and mobile Chrome and Safari kill the tab before it finishes. On a phone or tablet the page now shows a warning instead of starting the worker, so the wasm is only fetched if the user picks Try anyway. The card has a Copy link button and points to Siti AI on the App Store or Google Play, whichever fits the device, plus a link to 5mb.app. A localStorage flag is set while the model loads and cleared once it is ready or fails. If it is still set on a visit within ten minutes, the last tab was killed mid-load, and the same card says so on any device. deploy.sh now ships the two store badges. Co-Authored-By: Claude Opus 5.5 Co-Authored-By: siGit Code v1.7.10 Co-Authored-By: OndeCode v1.1.2 --- examples/web-chat/README.md | 15 +++- examples/web-chat/deploy.sh | 3 +- examples/web-chat/www/badges/app-store.svg | 46 ++++++++++ examples/web-chat/www/badges/google-play.png | Bin 0 -> 4698 bytes examples/web-chat/www/index.html | 44 ++++++++++ examples/web-chat/www/main.js | 86 +++++++++++++++++-- examples/web-chat/www/style.css | 13 +++ 7 files changed, 199 insertions(+), 8 deletions(-) create mode 100755 examples/web-chat/www/badges/app-store.svg create mode 100644 examples/web-chat/www/badges/google-play.png diff --git a/examples/web-chat/README.md b/examples/web-chat/README.md index 6cd8956..b32933b 100644 --- a/examples/web-chat/README.md +++ b/examples/web-chat/README.md @@ -35,8 +35,9 @@ CLI 1.1.0 or newer and a prior `smb login`. ./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/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 0000000000000000000000000000000000000000..7a06997a57236e18b5bd2a152435911b72371a89 GIT binary patch literal 4698 zcmV-g5~b~lP)}M@%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