@ondeinference / ed Mirror · read-only / commits / a13a5a3
Fork 0

Read-only mirror of github.com/ondeinference/ed.

Mirrored from https://github.com/ondeinference/ed.git

Synced Nov 23, 01:00 UTC

web-chat: publish the demo at ondewebdemo.5mb.app

Add deploy.sh and the smbCloud config that ship www/ as a static artifact, plus share metadata and an Onde byline on the page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: siGit Code v1.6.6-acp <noreply@sigit.si>

Seto Elkahfi committed Nov 17, 2026 at 22:35 UTC a13a5a3c184b9e8cafa88161e13e6b2767dbbf5c
5 files changed +111
examples/web-chat/.smb/config.toml new
+15
@@ -0,0 +1,15 @@
1 +name = "ondewebdemo"
2 +description = "Ed running in the browser, published at ondewebdemo.5mb.app."
3 +
4 +[project]
5 +id = 50
6 +# The App the artifact deploy publishes to. The server allocates the target dir.
7 +frontend_app_id = "c0277812-c891-4f4b-a3ee-c8cb371bb629"
8 +name = "ondewebdemo"
9 +# static: nginx serves the directory off disk. No build, no process, no port.
10 +runner = 1
11 +# `smb deploy --prebuilt` publishes an artifact over HTTPS (see deploy.sh).
12 +deployment_method = 1
13 +repository = "ondewebdemo"
14 +description = "Ed running in the browser."
15 +source = "."
examples/web-chat/README.md
+17
@@ -23,6 +23,23 @@ a local checkout:
23 ./build.sh --config 'patch.crates-io.onde.path="../../../onde"'
24 ```
25
26 +## Deploy
27 +
28 +The demo is published at <https://ondewebdemo.5mb.app> as a static site on
29 +smbCloud (app `ondewebdemo`, in the Onde Inference project). It needs the `smb`
30 +CLI 1.1.0 or newer and a prior `smb login`.
31 +
32 +```bash
33 +./build.sh --config 'patch.crates-io.onde.path="../../../onde"'
34 +./deploy.sh --dry-run # lists the files, uploads nothing
35 +./deploy.sh # publishes, then waits for /version.txt to match
36 +```
37 +
38 +`deploy.sh` ships only `index.html`, `main.js`, `worker.js`, `style.css` and the
39 +two files in `pkg/` that the page loads. Each deploy is a new release, and
40 +`/version.txt` holds the commit it was built from (`-dirty` if the tree had
41 +uncommitted changes). The site is static and needs no special headers.
42 +
43 ## What it downloads
44
45 Qwen 2.5 0.5B (GGUF, about 380 MB), once, on the first click of Download. It
examples/web-chat/deploy.sh new
+62
@@ -0,0 +1,62 @@
1 +#!/usr/bin/env bash
2 +# Publish www/ to https://ondewebdemo.5mb.app with the smbCloud CLI (smb >= 1.1.0).
3 +#
4 +# ./deploy.sh --dry-run stage and list the files; uploads nothing
5 +# ./deploy.sh stage, deploy, then check /version.txt
6 +#
7 +# Run ./build.sh first: this ships whatever is in www/pkg. Auth is the token
8 +# from `smb login`, or SMB_TOKEN in CI.
9 +set -euo pipefail
10 +cd "$(dirname "$0")"
11 +
12 +# The App .smb/config.toml must name. A stale config once sent a deploy into
13 +# another app's directory, so a mismatch stops here before anything is written.
14 +EXPECTED_APP_ID="c0277812-c891-4f4b-a3ee-c8cb371bb629"
15 +URL="https://ondewebdemo.5mb.app"
16 +
17 +app_id="$(sed -n 's/^frontend_app_id *= *"\([^"]*\)".*/\1/p' .smb/config.toml | head -n 1)"
18 +if [ "$app_id" != "$EXPECTED_APP_ID" ]; then
19 + echo "refusing to deploy: .smb/config.toml says frontend_app_id ${app_id:-?}, expected $EXPECTED_APP_ID" >&2
20 + exit 1
21 +fi
22 +
23 +for f in www/pkg/web_chat.js www/pkg/web_chat_bg.wasm; do
24 + [ -f "$f" ] || { echo "missing $f; run ./build.sh first" >&2; exit 1; }
25 +done
26 +
27 +version="$(git rev-parse --short HEAD)"
28 +git diff --quiet HEAD -- . || version="$version-dirty"
29 +
30 +# Only the servable files. www/pkg also holds a README, package.json and
31 +# .gitignore from wasm-pack that have no place on the site.
32 +stage="$(mktemp -d)"
33 +trap 'rm -rf "$stage"' EXIT
34 +mkdir "$stage/pkg"
35 +cp www/index.html www/main.js www/worker.js www/style.css "$stage/"
36 +cp www/pkg/web_chat.js www/pkg/web_chat_bg.wasm "$stage/pkg/"
37 +printf '%s\n' "$version" > "$stage/version.txt"
38 +# Config only: the CLI reads it and leaves it out of the upload.
39 +cp -R .smb "$stage/.smb"
40 +
41 +echo "version: $version"
42 +echo "app: $app_id"
43 +echo "cli: $(smb --version 2>&1)"
44 +
45 +if [ "${1:-}" = "--dry-run" ]; then
46 + (cd "$stage" && smb --ci deploy --prebuilt --dry-run)
47 + exit 0
48 +fi
49 +
50 +(cd "$stage" && smb --ci deploy --prebuilt)
51 +
52 +echo "waiting for $URL/version.txt to report $version"
53 +for _ in $(seq 15); do
54 + live="$(curl -fsS --max-time 5 -H 'Cache-Control: no-cache' "$URL/version.txt" 2>/dev/null | tr -d '[:space:]' || true)"
55 + if [ "$live" = "$version" ]; then
56 + echo "live: $URL serves $version"
57 + exit 0
58 + fi
59 + sleep 2
60 +done
61 +echo "$URL did not report $version within 30s (last saw: ${live:-nothing})" >&2
62 +exit 1
examples/web-chat/www/index.html
+15
@@ -5,6 +5,19 @@
5 <meta name="viewport" content="width=device-width, initial-scale=1" />
6 <meta name="color-scheme" content="light dark" />
7 <title>Ed, in your browser</title>
8 + <meta
9 + name="description"
10 + content="Ed is a language model that runs entirely in your browser. It downloads once, stays on your device, and nothing you type leaves it."
11 + />
12 + <meta property="og:type" content="website" />
13 + <meta property="og:site_name" content="Onde" />
14 + <meta property="og:title" content="Ed, in your browser" />
15 + <meta
16 + property="og:description"
17 + content="A language model that runs entirely on your device. Nothing you type leaves it."
18 + />
19 + <meta property="og:url" content="https://ondewebdemo.5mb.app/" />
20 + <meta name="twitter:card" content="summary" />
21 <link rel="stylesheet" href="style.css" />
22 </head>
23 <body>
@@ -55,6 +68,8 @@
68 <button id="clear" type="button" class="link">Remove model</button>
69 </footer>
70 </section>
71 +
72 + <p class="byline">Ed runs on <a href="https://ondeinference.com">Onde</a>.</p>
73 </main>
74 <script type="module" src="main.js"></script>
75 </body>
examples/web-chat/www/style.css
+2
@@ -119,6 +119,8 @@ textarea {
119
120 footer { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.8125rem; }
121 .spacer { flex: 1; }
122 +.byline { margin: 0; text-align: center; color: var(--muted); font-size: 0.8125rem; }
123 +.byline a { color: inherit; text-underline-offset: 3px; }
124 #stats { font-variant-numeric: tabular-nums; }
125
126 .visually-hidden {