Repository navigation
feat: site owner configures the model source; no download address in the plugin (#228) - #239
Conversation
…the plugin (#228) WP.org has flagged WebLLM's built-in model download addresses in four review rounds (latest R agentic-admin/28May26/T5 27Sep26/4.3). The model files (1.2 GB+) and their compiled libraries can't ship in the plugin, so the download source becomes a site-owner setting, the same way the remote LLM endpoint already is. - tools/strip-webllm-prebuilt-loader.js: webpack loader that empties WebLLM's prebuiltAppConfig.model_list and modelLibURLPrefix. The build fails if the expected code is missing, so an upgrade can't bring the addresses back. Bundles now contain no huggingface.co or raw.githubusercontent.com address. - Option agentic_admin_model_source (weights_url, library_url), registered with show_in_rest so it saves through /wp/v2/settings (manage_options). No default. Sanitized with esc_url_raw (http/https) + trailing slash. Removed on uninstall. - model-source.js builds WebLLM's appConfig from the owner's addresses; model-loader passes it to CreateMLCEngine, CreateServiceWorkerMLCEngine and hasModelInCache. Loading is refused until a source is set. - Settings gets a "Model source" card; Load Model is disabled with a notice until a source is set. Remote and Connector engines are unaffected. - readme lists the MLC-AI addresses to paste, under External services. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Agree with the direction. After four rounds of the same template, changing the design is better than a fifth reply arguing the service exception. It also answers their June question ("configurable by the site owner?") with a clear yes. And no pre-fill for now: a default in PHP is the same "plugin picked the host" situation, so asking them first is right. I checked the code against WebLLM 0.2.82. The four model records match WebLLM's own records exactly, 1. The strongest objection they could still raise. The 2. Self-hosting needs a specific folder layout, and the readme doesn't say so. WebLLM's 3. The library version is now stored per site. The readme address ends in 4. Existing users lose the local engine when they update. With no source set, Smaller things:
I haven't done the full in-browser model download; that's Marcel's Playground run. Once that passes and 2–4 are handled or answered, 👍 from me. |
|
One more I missed: |
- Library URL is a base address; buildAppConfig() appends WebLLM's modelVersion, so a WebLLM upgrade picks matching libraries without owners editing their settings. - Readme and Settings help document the self-hosting layout (<weights>/<model>/resolve/main/, <library>/<version>/). - Model source accepts https only (http is blocked as mixed content). - Load Model and the Settings warning update live after saving, via a model-source subscription. - The "no model source" notice links to #model-source, which opens Settings and scrolls to the card. - Upgrade Notice for existing local-engine users; screenshot caption 2 no longer names a fixed host. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Thanks @ivdimova, all handled in 6efa590:
Smaller ones:
82 unit tests pass (added one for the subscription), lint is clean, and both bundles contain 0 model addresses. Marcel's in-browser download test is next. |
|
In-browser test passed (Marcel, WordPress Playground with this build): with no source set, Load Model is disabled and the notice links to Settings → Model source. After pasting the MLC-AI addresses and saving, Load Model enables without a reload, and the model downloads and runs. That covers the last open item from your review, so merging. |
@ivdimova I'd like your opinion on the approach before we submit, not just the code.
Why
WP.org has flagged "calling files remotely" in four rounds, most recently in
R agentic-admin/28May26/T5 27Sep26/4.3(27 Sep). Every time they quote the same WebLLM lines: its built-in GitHub address for model libraries, plus a list of about 140 models with Hugging Face URLs. We've argued it's a service (in the readme and in replies), and they re-sent the same template each time.The model files can't ship in the plugin: the default model is 1.2 GB, and the compiled model libraries (
.wasm) are hosted only on GitHub.The approach
Treat the model download like the remote LLM endpoint, which the site owner types in and which WP.org has never flagged in five rounds:
tools/strip-webllm-prebuilt-loader.js) empties WebLLM's built-in list and GitHub prefix. The build fails if WebLLM changes shape.index.jsandsw.jswent from 278huggingface.co/ 2raw.githubusercontent.comaddresses to 0 / 0.agentic_admin_model_source(weights URL + library URL), with no default. It's saved through core's/wp/v2/settings, so only admins can change it (tested: logged-out → 401,javascript:rejected). It's removed on uninstall.The trade-off I'd like your view on
Pro: it answers the question the reviewer asked back in June: are the assets "configurable by the site owner, user-supplied, or tied to third-party providers?" The answer becomes "configured by the owner". It also removes the exact strings their tool matches.
Con: a new user has to paste two addresses before the local engine works, which is worse first-run UX. Marcel asked about pre-filling them. I advised against it, because a default would put the addresses back in the plugin (PHP instead of JS) and be the same "plugin picked the host" situation. The plan is to ask the reviewer directly in our reply whether a pre-filled, owner-editable default would be acceptable, and add it later only with their OK.
Is this the right call, or would you handle it differently (e.g. pre-fill now, or keep arguing the service exception)?
Testing
/wp/v2/settings, and the empty state shows correctly.The #238 fixes (Tested up to, escaping) are merged but not yet uploaded. The plan is one upload with this PR included, if we go ahead.
🤖 Generated with Claude Code