Files
msime-windows/engine/contracts/webview
Lu Fan(SonnyCalcr) 649747f8cd feat(server): 神经网络整句效果优先模型改为按需下载 (#838)
效果优先模型(sentence-model-desktop.safetensors,约 25 MB)不再随安装包分发,
改为和八股文模型一样在设置页下载后才能使用。

- engine:SentenceAssociationOptions 新增 neural_desktop_model 路径,留空即模型缺席、
  静默不重排;词典不再从资源目录固定加载效果档。load_file 按 UTF-8 打开路径,
  数据目录在非 ASCII 用户目录下也能读到模型
- server:新增 settings/neural_model,下载到 <数据目录>\models\neural-desktop\,
  下载与导入都按 neural-model/lock.json 的字节数和 SHA256 校验后原子落位;
  会话层只在开关打开时解析模型路径
- ui-html:设置页增加下载 / 导入 / 删除 / 浏览器下载,模型未就绪时开关置灰
- installer:不再打包效果档模型;旧版装进数据目录根下的那份在覆盖安装与卸载时清掉

原有配置项 sentence_neural_desktop 保持不变,用户的开关状态升级后保留。
2026-10-11 18:08:33 +08:00
..

WebView messages

messages.json owns the message envelope, payload shape, and allowed sender windows. Change it here, run python3 generate.py, and re-sync the copy under ui-html/ in the same commit. The generated TypeScript union and embedded C++ schema must pass generate.py --check. runtime.js and validator.h implement the documented schema subset and run the same fixtures.json compatibility cases. The standalone CMake test requires Boost.JSON; the input engine itself does not acquire that dependency.

New messages carry protocolVersion: 1. A missing version is accepted as legacy v1 for existing skins; an explicit unknown version, unknown message, invalid payload, or message sent from the wrong window is rejected before dispatch. This is envelope validation, not a replacement for domain checks such as dictionary key validation, allowed configuration values, or the host's HTTPS URL policy.

ui-html/scripts/sync-contracts.py materializes these bindings into ui-html/webview2/shared and checks byte equality; CI runs it with --check, which now compares against this directory directly rather than against a pinned submodule. Settings imports the typed serializer and checks incoming messages. Classic candidate, toolbar and menu pages load the same runtime from the host's https://msime-contracts/ virtual mapping; packaging must include webview2/shared.

Server-to-page candidate rendering currently uses the existing view functions; this contract covers WebMessage actions and settings responses. Candidate view model ownership is documented separately from transport envelopes.