Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bc1ae6ce6 | ||
|
|
309d2d7773 | ||
|
|
808abbc766 |
No files matched your search
@@ -16,6 +16,18 @@
|
||||
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
|
||||
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
|
||||
|
||||
## v3.26.71(2026-11-25)设置体验收口 + 配置节点默认模型
|
||||
|
||||
**宿主**
|
||||
- **设置页默认打开「通用」标签**(此前是「生图服务」):首屏先看全局设置,模型/Key 按需再切。
|
||||
- **左下角「更多」从空操作改为快捷菜单**:首页 / 插件 / 源码地址 / 版本号 / 检查更新。桌面端挂载即静默检查更新;**发现新版本时 ⋯ 变成圆形上箭头升级图标**,点开菜单首项即可走 Tauri 原地升级(签名校验在 Rust 侧)。
|
||||
- **模型删除改为行内垃圾桶按钮**:生图模型与分层模型行的「⋯ → 删除模型」两级操作压成一步;内置模型的垃圾桶禁用并带说明;按钮常态隐藏、悬停行才显形防误触。样式沿用设计 token。
|
||||
- **模型行样式优化**:启用复选框换成圆角开关(保留隐藏 checkbox 兼容既有选择器);质量胶囊去掉外框小方框、只留底色+文字;分层模型行同步。
|
||||
- **新增「新建配置节点默认模型」**(通用 tab 单独一组):下拉列出所有服务商已启用模型;新建配置节点(工具栏/右键/连线三条路径)统一预选该模型,已有节点不动。默认模型所在行加淡底 + 蓝描边 + 「默认」标识。配置存 `defaultGen{providerId,model,keyGroup}` 随备份走;模型被删/关闭时自动回退主服务首个启用模型;未设置时保留原系统默认。与 LLM 渠道的 `defaultModel` 隔离。
|
||||
- 配置节点默认模型逻辑落在新模块 `src/generation-default-model.js`,`DEFAULTS.gen` 用 getter 实时读取,宿主只做装配。
|
||||
|
||||
**验证**:`verify:ci` 全绿;新增单测 + 2 条 e2e 覆盖默认模型链路,既有 settings-crud / quality-tier / shape-settings 无回归。
|
||||
|
||||
## v3.26.70(2026-11-25)修浏览器面板 / 独立窗口里 `target="_blank"` 链接点了没反应
|
||||
|
||||
**宿主**
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ build esbuild 打包到 dist/(单 dist/app.js = src/ 模块按序
|
||||
node --check app.js 与 dist/app.js 语法
|
||||
check-dist.js 产物体检
|
||||
lint ESLint(src/ + app.js,正确性规则)
|
||||
test:unit 127 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底))
|
||||
test:unit 128 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底))
|
||||
test relay-task-graph-fixture + iwb-v32-web-test
|
||||
test:facts 事实基线守门(见 §5)
|
||||
typecheck 渐进类型检查(tsc --noEmit;范围 = src/*.js,不含 app.js)
|
||||
|
||||
@@ -533,6 +533,7 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
llm: wMigrateLlm((cfg && cfg.llm) || {}),
|
||||
canvas: Object.assign(wClone(W_DEF_CANVAS), (cfg && cfg.canvas) || {}),
|
||||
webhook: Object.assign(wClone(W_DEF_WEBHOOK), (cfg && cfg.webhook) || {}),
|
||||
defaultGen: (cfg && cfg.defaultGen && typeof cfg.defaultGen === 'object') ? wClone(cfg.defaultGen) : null,
|
||||
}
|
||||
}
|
||||
// 磁盘上的**原样**配置对象(未归一化)。用途只有一个:让"未知字段"在写入时不被吃掉。
|
||||
@@ -641,6 +642,7 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
},
|
||||
},
|
||||
outputsRetention: cfg.outputsRetention,
|
||||
defaultGen: cfg.defaultGen || null,
|
||||
llm: {
|
||||
providers: (cfg.llm.providers || []).map((p) => ({
|
||||
id: p.id, name: p.name || 'LLM 渠道', baseUrl: p.baseUrl || '', fallbacks: (p.fallbacks || []).map((u) => String(u || '').trim()).filter(Boolean),
|
||||
@@ -3371,6 +3373,9 @@ try { if (window.IWBMiniMapFit && typeof window.IWBMiniMapFit.install === 'funct
|
||||
// 分层(seedream 图层分离):清单即「提示词」的结构化形态,一行一层;bbox 为原图像素坐标 [x1,y1,x2,y2] 或 null
|
||||
layer: { model: 'doubao-seedream-5-0-pro-260628', provider: 'tuzi', keyGroup: 'daily', sizeParam: '1K', layers: [{ id: 'L1', name: '背景装饰层', bbox: null }, { id: 'L2', name: '主体视觉层', bbox: null }, { id: 'L3', name: '文字标题层', bbox: null }], result: null },
|
||||
}
|
||||
// 2026-11-25:新建配置节点的默认服务商/模型/密钥组跟随设置里的 defaultGen(未配置时保留上面的硬编码)。
|
||||
// getter 让三条建节点路径(工具栏/右键/连线)无需改动;未配置返回原值 ⇒ 存量行为零变化。
|
||||
;(() => { const M = window.IWBDefaultGenModel; if (!M) return; const pick = () => M.wResolveDefaultGen(wRawCfg()) || {}; for (const [k, f] of [['model', 'model'], ['provider', 'providerId'], ['keyGroup', 'keyGroup']]) Object.defineProperty(DEFAULTS.gen, k, { get: () => pick()[f] || ({ model: 'gpt-image-2', provider: 'tuzi', keyGroup: 'daily' })[k], enumerable: true, configurable: true }) })()
|
||||
// 节点默认数据逐节点浅拷贝:DEFAULTS 是共享模板,数组字段(如分层清单)必须复制,否则节点之间会串改。
|
||||
function cloneNodeDefaults(type) {
|
||||
const d = { ...((DEFAULTS && DEFAULTS[type]) || {}) }
|
||||
@@ -8483,14 +8488,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
onHotkeys: () => { setHelpMode('keys'); setHelpOpen(true) },
|
||||
onSkin: () => { try { toggleTheme() } catch (e) { /* ignore */ } },
|
||||
onSettings: () => setSettingOpen(true),
|
||||
onMore: (ev) => {
|
||||
try {
|
||||
const r = ev.currentTarget.getBoundingClientRect()
|
||||
const M = 210
|
||||
setWsMorePos({ top: Math.min(r.top, (window.innerHeight || 800) - 320), left: Math.min(r.right + 6, (window.innerWidth || 1000) - M - 6) })
|
||||
} catch (e) { /* ignore */ }
|
||||
setWsMoreOpen((v) => !v)
|
||||
},
|
||||
appVersion: APP_VERSION,
|
||||
}) : null,
|
||||
shellView === 'canvas' && enteringWs ? el('div', { className: 'iwb-enter-loading' }, el('div', { className: 'iwb-enter-spinner' }, null), el('div', { className: 'iwb-enter-text' }, '正在打开画布…')) : null,
|
||||
// 插件整页(v3.25.59):主组「插件」图标进入;返回回到画布
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
- 图片**新写入主通道 = IndexedDB Blob `{__blob}` / key `imgblob_<hash>_<len>`** (A) `app.js:2143`;`{__cache}`(Cache Storage)为兜底;\`ref_\`(`app.js` 内定义的 `IDB_REF_PREFIX = 'ref_'`)为 legacy 形态 (A)。
|
||||
- 大图判定:`isBigDataUrl` = `data:` 且 `length > 3000` (A) `app.js:2018`;**画布保存保留阈值** `< 16384` 才原样保留 (A) `app.js:2182`。**两处阈值并存,含义不同**。
|
||||
- 单测是**源码契约测试**:`tests/` 目录共 **493** 处源码文本钉点(`source.includes` / `source.indexOf` / `/re/.test(source)`),分布在 **20** 个文件(其中 `iwb-v32-web-test.js` 一个就占 **407**)→ **结构性重构会先打红测试**。**该数字已由 `tests/source-text-ratchet-test.js` 的「只减不增」棘轮守门**(2026-10-20 起守卫范围从 1 个文件扩到全目录:新增任何一处源码文本钉点都会打红)。**2026-11-12 复算**(`npm run audit:pins`,v3.24.76):二分 STRUCT **417** / NAME **76**;形态 **POS 403 / NEG 87 / COUNT 3**;难度 **易 62 / 中 316 / 难 115**。钉点减法第一批(v3.24.72)把 **537 → 505**:8 条探针钉点改为「门禁内 spec 是否真的读该计数器」、5 条改为运行时断言(生产态 `window` 上无探针)、10 条改为 DOM 断言(质量档位禁用 / 传输页无三模式按钮 / 模型项 title)、4 条改为运行时对象断言(健康检查两域、策略对象冻结)、其余 9 条有同文件 DOM 等价断言或仅剩 NEG。第二批(v3.24.76)把 **505 → 493**:94-5~7 三条「多标签释放语义」(10 处正则)换成 `tests/iwb-tabs-release.spec.js` 的 3 条真 e2e,剩 1 条「消费方契约」(断言该 spec 在门禁内且 spec 源码真的读两个探针);另 2 条 `wPurgeIntent.add` 钉点改为读 `src/workspace-purge.js`。**这一批一换就查出 3 个真缺陷**(objectURL 从未释放 / 彻底删除留孤儿标签 · session / 刷新后误回收打开标签的图)—— 见 CHANGELOG v3.24.76。
|
||||
- `app.js` = 单 IIFE **9,173 行**(**双层预算**:绝对上限 9,173 / 占总源码 ≤ 40%,现 **30.3%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **3,046 行**(上限 **3,046**,余量 0;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **110** 个模块 / 21,079 行,`sourceModules` 110 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。
|
||||
- `app.js` = 单 IIFE **9,171 行**(**双层预算**:绝对上限 9,173 / 占总源码 ≤ 40%,现 **30.1%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **3,039 行**(上限 **3,046**,余量 7;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **111** 个模块 / 21,279 行,`sourceModules` 111 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。
|
||||
- 门禁:`npm run verify` = `verify:ci`(`build` → `node --check app.js` → `node --check dist/app.js` → `check-dist.js` → `lint`(ESLint 正确性规则,`src/` + `app.js`,P4-16a)→ `test:unit` → `test` → `test:facts`)+ `test:e2e` (A) `package.json`。
|
||||
|
||||
## 2. 门禁与环境现状
|
||||
@@ -167,7 +167,7 @@
|
||||
- 同一张图被 3 个节点引用、hydrate 成 3 个不同 objectURL 时,preview/display 缓存各自 miss → 重复解码(与 F2 相邻)。
|
||||
- **F10|`refs.genScheduler` 是桩** (A) → 未接线,暂无运行时影响(P3)。
|
||||
- **F11|已建但未接线的模块层(2026-10-17 接线审计;2026-10-18 复核更正)** (A)
|
||||
- **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**110 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。
|
||||
- **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**111 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。
|
||||
- **仅被测试引用(9 模块 + 2 导出)**:`canvas-domain`、`generation-retry`、`generation-service`、`runtime-recovery-runner`、`runtime-state-bridge`、`runtime-store`、`storage-reconcile`、`storage-result`、`workspace-service`;导出 `IWBStorageHealthFactory`、`IWBPluginHostFactory`。(`storage-result` 是**存储层共享结果类型**,被 6 个存储模块读取,**非死代码**;`runtime-store` 为状态模型 epic 地基。)
|
||||
- **app.js 零引用(1 模块 + 3 导出)**:模块 `generation-controller`;导出 `IWBRuntimeMetricsFactory`、`IWBStorageRuntimeFactory`、`IWBUIComponents`。`canvas-relations` 已随 `06cf211` 删除(本文档早前把它列为"唯一可删者",实际已删)。零引用证据 = `grep -rn "<名字>" .`(排除 `node_modules|dist|vendor|test-results`)**只命中其自身赋值行**。
|
||||
- **半接线 / 未接线**:`IWBRuntimeStateBridge` **无 app.js 引用(仅测试)**;`IWBRuntimeRunContext` **已接线**(`runNode` 读取运行上下文);`IWBGenerationController` 是完整但**从未被调用**的工厂;`ModularWorkspaceStore`(`app.js` 内)是 `storage-workspace` 的**预留接线 seam**(当前无下游使用,保留);`window.IWBImageFolder` 自注册后读回(装载路径)。
|
||||
@@ -183,7 +183,7 @@
|
||||
| `storage-reconcile` | 存储对账(`createReconciler`/`check`) | 内联对账 | 存储层收口 |
|
||||
| `runtime-recovery-runner` | 执行恢复候选(`candidate`/`valid`/`run`) | 内联恢复 | 断点恢复 |
|
||||
| `canvas-domain` | 画布域模型(`commit`/`updateNode`/`deleteNodes`…) | `CanvasStore` 那一套 | Workbench 解耦(P2-9) |
|
||||
- **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**91** 项)与 `sourceModules` 顺序(**110** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
|
||||
- **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**92** 项)与 `sourceModules` 顺序(**111** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
|
||||
|
||||
## 12. 易踩的坑
|
||||
|
||||
@@ -254,7 +254,7 @@
|
||||
|
||||
**信任模型(必须明示)**:形态 A 的插件是**可信代码**(与核心同权限、无沙箱);启停与设置是 UX 与可维护性手段,**不是安全边界**(同 §13.27 教训:前端开关一定可被绕过)。
|
||||
|
||||
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**91** 项)与 `sourceModules` 顺序(**110** 项);新增模块、新增耦合、新增 dev 探针都**必须有意重生成对应快照**(`IWB_WRITE_BOUNDARY_SNAPSHOT=1`)。契约与行为的可执行验证在 `tests/plugin-host-test.js`(宿主单测)与 `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 + `iwb-dev-probe`,不进 34 门禁)。
|
||||
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**92** 项)与 `sourceModules` 顺序(**111** 项);新增模块、新增耦合、新增 dev 探针都**必须有意重生成对应快照**(`IWB_WRITE_BOUNDARY_SNAPSHOT=1`)。契约与行为的可执行验证在 `tests/plugin-host-test.js`(宿主单测)与 `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 + `iwb-dev-probe`,不进 34 门禁)。
|
||||
|
||||
**关键陷阱**:`normalizeNodes`(现位于 `src/canvas-normalize.js`)会**静默丢弃**不在 `NODE_H` 里的节点类型 ⇒ 新增节点类型必须先登记 `NODE_H`,否则节点一刷新就消失(§13.27 规则三的同一失败模式)。
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-workbench-web",
|
||||
"private": true,
|
||||
"version": "3.26.70",
|
||||
"version": "3.26.71",
|
||||
"description": "Browser-based node canvas image workbench",
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js && node scripts/copy-plugins.js",
|
||||
@@ -10,7 +10,7 @@
|
||||
"app:build": "tauri build",
|
||||
"lint": "eslint src app.js",
|
||||
"test": "node tests/relay-task-graph-fixture-test.js && node tests/plugin-style-node-test.js && node tests/inherit-text-test.js",
|
||||
"test:unit": "node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/design-tokens-component-doc-test.js && node tests/theme-static-snapshot-test.js && node tests/overlay-layer-test.js && node tests/settings-scope-test.js && node tests/node-scope-test.js && node tests/appearance-v2-test.js && node tests/image-prompt-cover-test.js && node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/album-task-graph-test.js && node tests/generation-endpoint-test.js && node tests/storage-config-shape-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/gallery-sync-test.js && node tests/image-blob-store-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/native-overlay-park-test.js && node tests/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-test.js && node tests/plugin-scale-contract-test.js && node tests/design-token-ratchet-test.js && node tests/theme-contrast-test.js && node tests/image-file-ref-preview-test.js",
|
||||
"test:unit": "node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/design-tokens-component-doc-test.js && node tests/theme-static-snapshot-test.js && node tests/overlay-layer-test.js && node tests/settings-scope-test.js && node tests/node-scope-test.js && node tests/appearance-v2-test.js && node tests/image-prompt-cover-test.js && node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/album-task-graph-test.js && node tests/generation-endpoint-test.js && node tests/storage-config-shape-test.js && node tests/generation-default-model-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/gallery-sync-test.js && node tests/image-blob-store-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/native-overlay-park-test.js && node tests/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-test.js && node tests/plugin-scale-contract-test.js && node tests/design-token-ratchet-test.js && node tests/theme-contrast-test.js && node tests/image-file-ref-preview-test.js",
|
||||
"test:diagnostics": "node tests/runtime-diagnostics-hotpath-test.js",
|
||||
"test:facts": "node tests/architecture-facts-guard-test.js && node tests/release-records-test.js",
|
||||
"plugins:gc": "node scripts/plugins-publish.mjs --gc",
|
||||
|
||||
@@ -64,6 +64,7 @@ const sourceModules = [
|
||||
'runtime-crash-log.js',
|
||||
'storage-health.js',
|
||||
'storage-config-shape.js',
|
||||
'generation-default-model.js',
|
||||
'storage-indexeddb.js',
|
||||
'storage-workspace.js',
|
||||
'storage-groups.js',
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
<title>插件开发规范 · Image Workbench</title>
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.69-mwvqce4x">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.71-mwvx91rw">
|
||||
<style>
|
||||
.devdoc{max-width:860px;margin:0 auto;padding:40px 0 72px;color:var(--ink,#1b1f24);font-size:15px;line-height:1.75}
|
||||
.devdoc h1{font-size:38px;line-height:1.2;margin:8px 0 18px}
|
||||
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.69</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.71</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
|
||||
@@ -57,18 +57,18 @@
|
||||
<h2>下载</h2>
|
||||
<div class="row">
|
||||
<div class="name">macOS · Apple Silicon<div class="hint">M1 / M2 / M3 / M4</div></div>
|
||||
<div class="meta">版本 3.26.69 · 8.4 MB · .dmg<div class="hash">sha256 a2e7c95b77b17a48…</div></div>
|
||||
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.69_aarch64.dmg?h=a2e7c95b77b1">下载</a>
|
||||
<div class="meta">版本 3.26.71 · 8.4 MB · .dmg<div class="hash">sha256 9fd7510d3a0efda1…</div></div>
|
||||
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.26.71_aarch64.dmg?h=9fd7510d3a0e">下载</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">macOS · Intel<div class="hint">x86_64</div></div>
|
||||
<div class="meta">版本 3.26.69 · 8.8 MB · .dmg<div class="hash">sha256 965196f1fd525c68…</div></div>
|
||||
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.69_x64.dmg?h=965196f1fd52">下载</a>
|
||||
<div class="meta">版本 3.26.71 · 8.8 MB · .dmg<div class="hash">sha256 469ba89d533d153b…</div></div>
|
||||
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.26.71_x64.dmg?h=469ba89d533d">下载</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">Windows · x64<div class="hint">需要 WebView2</div></div>
|
||||
<div class="meta">版本 3.26.69 · 4.8 MB · .exe<div class="hash">sha256 9cd82072998f7f1e…</div></div>
|
||||
<a class="btn" href="/updates/windows-x86_64/image-workbench_3.26.69_x64-setup.exe?h=9cd82072998f">下载</a>
|
||||
<div class="meta"></div>
|
||||
<span class="muted">暂未提供</span>
|
||||
</div>
|
||||
|
||||
<h2>系统要求</h2>
|
||||
@@ -97,6 +97,14 @@
|
||||
</ol>
|
||||
|
||||
<h2>历史版本</h2>
|
||||
<div class="row">
|
||||
<div class="name">3.26.71<div class="hint">设置默认通用 tab / 左下快捷菜单+升级图标 / 模型行样式 / 新建配置节点默认模型</div></div>
|
||||
<div class="meta">2026-11-25<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.70<div class="hint">修浏览器面板/独立窗口中 target=_blank 链接无反应(原地打开)</div></div>
|
||||
<div class="meta">2026-11-25<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="name">3.26.69<div class="hint">相册 1.1.0:方形宫格 / 一键清空 / 放大镜 hover 预览 + 点击全屏;修复相册的图在组合节点与参考图里显示为破图</div></div>
|
||||
<div class="meta">2026-11-25<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
|
||||
|
||||
+8
-8
@@ -4,7 +4,7 @@
|
||||
<meta name="description" content="本地优先的 AI 生图无限画布:节点式工作流、插件按需安装、数据全部留在本机。">
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.69-mwvqce4x">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.71-mwvx91rw">
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
@@ -17,19 +17,19 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.69</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.71</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
<section class="hero hero-art">
|
||||
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.69-mwvqce4x" alt=""></div>
|
||||
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.26.71-mwvx91rw" alt=""></div>
|
||||
<div class="hero-veil"></div>
|
||||
<div class="wrap">
|
||||
<span class="kicker">v3.26.69 · macOS / Windows · 数据在本地</span>
|
||||
<span class="kicker">v3.26.71 · macOS / Windows · 数据在本地</span>
|
||||
<h1>本地优先的<br>AI 生图无限画布</h1>
|
||||
<p class="sub">用节点把「参考图 → 提示词 → 批量生成 → 图库」串成一条生产线。<br>图片、提示词、模型配置全部留在你自己的电脑里,插件按需安装。</p>
|
||||
<div class="cta">
|
||||
<a class="btn primary lg" href="/download/">下载 v3.26.69</a>
|
||||
<a class="btn primary lg" href="/download/">下载 v3.26.71</a>
|
||||
<a class="btn lg" href="/plugins/">浏览 13 个插件</a>
|
||||
</div>
|
||||
<div class="meta">支持 macOS 12+ 与 Windows 10 1803+ · 安装包约 7 MB · 无需登录</div>
|
||||
@@ -96,9 +96,9 @@
|
||||
<section class="section"><div class="wrap">
|
||||
<h2>下载 Image Workbench</h2>
|
||||
<p class="lead">选你的平台。装过一次之后,以后在应用内「设置 → 通用 → 版本与更新」就能一键升级。</p>
|
||||
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.69_aarch64.dmg?h=a2e7c95b77b1"><div class="n">macOS · Apple Silicon</div><div class="s">M1 / M2 / M3 / M4 · 8.4 MB · .dmg</div></a>
|
||||
<a href="/updates/darwin-x86_64/image-workbench_3.26.69_x64.dmg?h=965196f1fd52"><div class="n">macOS · Intel</div><div class="s">x86_64 · 8.8 MB · .dmg</div></a>
|
||||
<a href="/updates/windows-x86_64/image-workbench_3.26.69_x64-setup.exe?h=9cd82072998f"><div class="n">Windows · x64</div><div class="s">需要 WebView2 · 4.8 MB · .exe</div></a></div>
|
||||
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.26.71_aarch64.dmg?h=9fd7510d3a0e"><div class="n">macOS · Apple Silicon</div><div class="s">M1 / M2 / M3 / M4 · 8.4 MB · .dmg</div></a>
|
||||
<a href="/updates/darwin-x86_64/image-workbench_3.26.71_x64.dmg?h=469ba89d533d"><div class="n">macOS · Intel</div><div class="s">x86_64 · 8.8 MB · .dmg</div></a>
|
||||
<div class="none"><div class="n">Windows · x64</div><div class="s">暂未提供</div></div></div>
|
||||
<div style="margin-top:20px;color:#9ca3af;font-size:12.5px">安装包未做 Apple 公证 / Windows 代码签名,首次打开需手动放行一次,细节见 <a href="/download/" style="text-decoration:underline">下载页</a>。</div>
|
||||
</div></section>
|
||||
</main>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<title>插件市场 · Image Workbench</title>
|
||||
<link rel="icon" href="/assets/favicon.png" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/assets/logo.png">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.69-mwvqce4x">
|
||||
<link rel="stylesheet" href="/assets/style.css?v=3.26.71-mwvx91rw">
|
||||
</head><body>
|
||||
<nav><div class="wrap inner">
|
||||
<a class="brand" href="/"><img class="logo" src="/assets/logo.png" alt="" width="26" height="26">Image Workbench</a>
|
||||
@@ -16,7 +16,7 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="btn" href="/plugins/">插件市场</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.69</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.26.71</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
|
||||
+43
-1
@@ -1,8 +1,50 @@
|
||||
{
|
||||
"app": "Image Workbench",
|
||||
"subtitle": "本地优先的 AI 生图无限画布 · 桌面版(Tauri v2)",
|
||||
"updatedAt": "2026-11-25T02:17:11.877Z",
|
||||
"updatedAt": "2026-11-25T09:29:05.783Z",
|
||||
"releases": [
|
||||
{
|
||||
"version": "3.26.71",
|
||||
"date": "2026-11-25",
|
||||
"notes": "设置默认通用 tab / 左下快捷菜单+升级图标 / 模型行样式 / 新建配置节点默认模型",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.71_aarch64.dmg",
|
||||
"size": 8790500,
|
||||
"sha256": "9fd7510d3a0efda1b78f5508207e09b96477f1227036868f147be70d846623e5",
|
||||
"h": "9fd7510d3a0e",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.71_x64.dmg",
|
||||
"size": 9204632,
|
||||
"sha256": "469ba89d533d153bf188277ff42294503944e0144c687652395ca5f94c8e6e78",
|
||||
"h": "469ba89d533d",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.70",
|
||||
"date": "2026-11-25",
|
||||
"notes": "修浏览器面板/独立窗口中 target=_blank 链接无反应(原地打开)",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.26.70_aarch64.dmg",
|
||||
"size": 8794989,
|
||||
"sha256": "b8e5bd9bd293796465880a690eb31b75e5de72815f104a55dac44b7c0f0428b4",
|
||||
"h": "b8e5bd9bd293",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.26.70_x64.dmg",
|
||||
"size": 9202029,
|
||||
"sha256": "a24037c72b6d138f05c8580496ba28a85c0dacf5d76544ce441e1ce63a956b0a",
|
||||
"h": "a24037c72b6d",
|
||||
"kind": "dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "3.26.69",
|
||||
"date": "2026-11-25",
|
||||
|
||||
Generated
+1
-1
@@ -1983,7 +1983,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "image-workbench"
|
||||
version = "3.26.70"
|
||||
version = "3.26.71"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"base64 0.22.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "image-workbench"
|
||||
version = "3.26.70"
|
||||
version = "3.26.71"
|
||||
description = "无限画布 · 生图工作台桌面版"
|
||||
authors = ["malongan"]
|
||||
license = ""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "image-workbench",
|
||||
"version": "3.26.70",
|
||||
"version": "3.26.71",
|
||||
"identifier": "com.malongan.imageworkbench",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/* default-gen-model.js —— 「新建配置节点默认模型」的纯函数(2026-11-25)
|
||||
*
|
||||
* 配置顶层 defaultGen = { providerId, model, keyGroup },决定新建 gen 节点预选的服务商 / 模型 / 密钥组。
|
||||
* 本模块只算值、不碰 I/O、不碰 DOM;宿主把结果同步到 DEFAULTS.gen 模板即可让三条建节点路径统一生效。
|
||||
*
|
||||
* 关键约定(避免回归):
|
||||
* ① 未配置 defaultGen ⇒ 返回 null,宿主保留原 DEFAULTS.gen 硬编码(gpt-image-2/tuzi/daily)——
|
||||
* 存量工作区与全部 e2e 的建节点行为零变化。
|
||||
* ② 已配置但指向的模型被删 / 关闭可见 ⇒ 自动回退到主服务(providers[0])第一个可见模型,
|
||||
* 并同步取该服务的第一个 Key 分组。仍无可用模型 ⇒ 返回 null(同①)。
|
||||
* ③ 与 LLM 渠道的 defaultModel 完全隔离,不读不写 llm.*。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
|
||||
const norm = (v) => String(v == null ? '' : v).trim()
|
||||
|
||||
// 生成候选列表: [{ providerId, model, keyGroup, label }],仅收可见模型(visible !== false)。
|
||||
function wDefaultGenOptions (cfg) {
|
||||
const providers = (cfg && Array.isArray(cfg.providers)) ? cfg.providers : []
|
||||
const out = []
|
||||
const seen = new Set()
|
||||
for (const p of providers) {
|
||||
const pid = norm(p && p.id)
|
||||
if (!pid) continue
|
||||
const group = ((p.keys || [])[0] || {}).id || ''
|
||||
for (const m of (p.models || [])) {
|
||||
const name = norm(m && (typeof m === 'string' ? m : m.name))
|
||||
if (!name || (m && typeof m === 'object' && m.visible === false)) continue
|
||||
const key = pid + '::' + name
|
||||
if (seen.has(key)) continue
|
||||
seen.add(key)
|
||||
out.push({ providerId: pid, model: name, keyGroup: norm(group), label: ((p && p.name) || pid) + ' · ' + name })
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// 解析生效值:未配置 ⇒ null(宿主保留硬编码,存量行为零变化);
|
||||
// 有效配置原样用;配置了但模型被删/关闭 ⇒ 回退主服务首个可见模型;无可用模型 ⇒ null。
|
||||
function wResolveDefaultGen (cfg) {
|
||||
const d = (cfg && cfg.defaultGen) || {}
|
||||
const pid = norm(d.providerId)
|
||||
const model = norm(d.model)
|
||||
if (!pid || !model) return null
|
||||
const opts = wDefaultGenOptions(cfg)
|
||||
if (!opts.length) return null
|
||||
const hit = opts.find((o) => o.providerId === pid && o.model === model)
|
||||
if (hit) return { providerId: hit.providerId, model: hit.model, keyGroup: norm(d.keyGroup) || hit.keyGroup }
|
||||
// 回退:主服务 = providers[0],取它的第一个可见模型(opts 已按 provider 顺序展开)
|
||||
const firstPid = norm((((cfg || {}).providers || [])[0] || {}).id)
|
||||
const fb = (firstPid && opts.find((o) => o.providerId === firstPid)) || opts[0]
|
||||
return { providerId: fb.providerId, model: fb.model, keyGroup: fb.keyGroup }
|
||||
}
|
||||
|
||||
// 配置保存前的校验/归一化:只接受候选里的有效项;失效项不写入,让读取侧走回退。
|
||||
function wNormalizeDefaultGen (cfg, incoming) {
|
||||
const d = (incoming && typeof incoming === 'object') ? incoming : {}
|
||||
const pid = norm(d.providerId)
|
||||
const model = norm(d.model)
|
||||
if (!pid || !model) return null
|
||||
const opts = wDefaultGenOptions(cfg)
|
||||
const hit = opts.find((o) => o.providerId === pid && o.model === model)
|
||||
return hit ? { providerId: hit.providerId, model: hit.model, keyGroup: norm(d.keyGroup) || hit.keyGroup } : null
|
||||
}
|
||||
|
||||
global.IWBDefaultGenModel = { wResolveDefaultGen, wDefaultGenOptions, wNormalizeDefaultGen }
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
+108
-16
@@ -7,12 +7,35 @@
|
||||
* · 底部组:帮助 / 快捷键 / 皮肤 / 设置 / 更多
|
||||
* · 选中态 = 深色圆底 + 白色图标;未选中 = 线性图标;悬停 = 浅灰圆底
|
||||
*
|
||||
* 纯展示组件:所有回调与当前视图经 props 传入,不读 Workbench 局部状态。
|
||||
* 2026-11-25:底部「更多」从空操作改为**快捷菜单**(首页 / 插件 / 源码 / 版本号),
|
||||
* 并在桌面端自动检查更新:有新版本时 ⋯ 变成「圆形上箭头」升级图标,点开菜单首项即可升级。
|
||||
* 更新检查/安装走 Tauri 的 check_update / install_update(签名校验在 Rust 侧)。
|
||||
* 全部状态自持于本组件,app.js 不需要新增状态或逻辑。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
const React = global.React || {}
|
||||
const ReactDOM = global.ReactDOM || {}
|
||||
const el = (type, prop, ...children) => React.createElement(type, prop, ...children)
|
||||
const useState = React.useState
|
||||
const useEffect = React.useEffect
|
||||
|
||||
// 升级图标(圆形内向上箭头):ICONS 在 app.js 里且行数已到棘轮上限,这里内联一份,不动宿主。
|
||||
const UPGRADE_PATH = '<circle cx="12" cy="12" r="9"/><path d="M12 16V8"/><path d="m8.5 11.5 3.5-3.5 3.5 3.5"/>'
|
||||
function UpgradeIcon () {
|
||||
return el('svg', {
|
||||
className: 'iwb-ic', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor',
|
||||
strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true,
|
||||
dangerouslySetInnerHTML: { __html: UPGRADE_PATH },
|
||||
}, null)
|
||||
}
|
||||
|
||||
const SOURCE_URL = 'https://github.com/malongan/image-workbench-web'
|
||||
function invoke (cmd) {
|
||||
const T = (typeof window !== 'undefined') ? window.__TAURI__ : null
|
||||
if (!T || !T.core || typeof T.core.invoke !== 'function') return Promise.reject(new Error('桌面端不可用'))
|
||||
return T.core.invoke(cmd)
|
||||
}
|
||||
|
||||
function IWBUINavRail (props) {
|
||||
const I = props.I
|
||||
@@ -24,9 +47,39 @@
|
||||
const onHotkeys = props.onHotkeys
|
||||
const onSkin = props.onSkin
|
||||
const onSettings = props.onSettings
|
||||
const onMore = props.onMore
|
||||
const skinIcon = props.skinIcon || 'moon'
|
||||
const logoIcon = props.logoIcon || 'palette'
|
||||
const appVersion = props.appVersion || ''
|
||||
const [moreOpen, setMoreOpen] = useState(false)
|
||||
const [morePos, setMorePos] = useState(null)
|
||||
const [update, setUpdate] = useState(null) // null=无更新;{version,...}=有新版本
|
||||
const [updateMsg, setUpdateMsg] = useState('')
|
||||
|
||||
const checkUpdate = () => {
|
||||
setUpdateMsg('正在检查…')
|
||||
return invoke('check_update').then((r) => {
|
||||
setUpdate(r && r.version ? r : null)
|
||||
setUpdateMsg(r && r.version ? ('发现新版本 v' + r.version) : '已是最新版本')
|
||||
}).catch((e) => {
|
||||
setUpdate(null)
|
||||
setUpdateMsg('检查失败:' + String((e && e.message) || e))
|
||||
})
|
||||
}
|
||||
// 挂载后静默检查一次(仅桌面端;网页版 invoke 立即 reject,被 catch 吞掉,不留 UI 噪音)
|
||||
useEffect(() => { checkUpdate() }, [])
|
||||
const upgrade = () => {
|
||||
setUpdateMsg('正在下载并安装,完成后会自动重启…')
|
||||
invoke('install_update').then(() => setUpdateMsg('安装完成,正在重启…'))
|
||||
.catch((e) => setUpdateMsg('更新失败:' + String((e && e.message) || e)))
|
||||
}
|
||||
useEffect(() => {
|
||||
if (!moreOpen) return undefined
|
||||
const onDown = (e) => { if (!e.target.closest || !e.target.closest('.iwb-nav-more-menu, .iwb-nav-more-btn')) setMoreOpen(false) }
|
||||
const onKey = (e) => { if (e.key === 'Escape') setMoreOpen(false) }
|
||||
document.addEventListener('pointerdown', onDown, true)
|
||||
document.addEventListener('keydown', onKey, true)
|
||||
return () => { document.removeEventListener('pointerdown', onDown, true); document.removeEventListener('keydown', onKey, true) }
|
||||
}, [moreOpen])
|
||||
|
||||
const item = (key, iconName, title, active, onClick) => el('button', {
|
||||
key,
|
||||
@@ -39,22 +92,61 @@
|
||||
onClick: (e) => { e.stopPropagation(); if (typeof onClick === 'function') onClick(e) },
|
||||
}, I(iconName))
|
||||
|
||||
return el('nav', { className: 'iwb-navrail', 'aria-label': '一级导航' },
|
||||
// v3.25.65:品牌 logo 移到顶部画布标签条(用户裁定),导航从图标组开始
|
||||
el('div', { className: 'iwb-navrail-group' },
|
||||
// v3.25.62:导航的「首页」保留(这是新版入口),删掉的是标签条里那个旧房子按钮
|
||||
item('home', 'home', '首页(画布库)', view === 'home', onHome),
|
||||
item('canvas', 'layer', '列表(画布工作区)', view === 'canvas', onCanvas),
|
||||
item('plugins', 'box', '插件', view === 'plugins', onPlugins),
|
||||
const toggleMore = (e) => {
|
||||
const r = e.currentTarget.getBoundingClientRect()
|
||||
setMorePos({ left: Math.max(6, r.right + 6), bottom: Math.max(6, global.innerHeight - r.bottom + 6) })
|
||||
setMoreOpen((v) => !v)
|
||||
}
|
||||
const act = (fn) => (e) => { e.stopPropagation(); setMoreOpen(false); if (typeof fn === 'function') fn(e) }
|
||||
const menuItem = (key, iconNode, text, onClick, cls) => el('button', {
|
||||
key, type: 'button', className: 'iwb-ctx-item' + (cls ? ' ' + cls : ''), onClick,
|
||||
}, iconNode, el('span', null, text))
|
||||
|
||||
const menu = !moreOpen || !morePos ? null : ReactDOM.createPortal(
|
||||
el('div', {
|
||||
className: 'iwb-ctxmenu iwb-nav-more-menu',
|
||||
style: { left: morePos.left + 'px', bottom: morePos.bottom + 'px' },
|
||||
onPointerDown: (e) => e.stopPropagation(),
|
||||
},
|
||||
update ? menuItem('up', el(UpgradeIcon, null), '升级到 v' + update.version + (update.notes ? ':' + update.notes : ''), act(upgrade), 'iwb-nav-more-up') : null,
|
||||
menuItem('home', I('home'), '首页', act(onHome)),
|
||||
menuItem('plugins', I('box'), '插件', act(onPlugins)),
|
||||
el('a', {
|
||||
key: 'src', className: 'iwb-ctx-item', href: SOURCE_URL, target: '_blank', rel: 'noopener',
|
||||
onClick: () => setMoreOpen(false),
|
||||
}, I('github'), el('span', null, '源码地址')),
|
||||
el('div', { key: 'ver', className: 'iwb-nav-more-ver' }, '版本 ' + (appVersion || '未知')),
|
||||
updateMsg ? el('div', { key: 'msg', className: 'iwb-nav-more-ver' }, updateMsg) : null,
|
||||
!update ? menuItem('check', I('refresh'), '检查更新', act(checkUpdate)) : null,
|
||||
),
|
||||
el('div', { className: 'iwb-navrail-spacer' }),
|
||||
el('div', { className: 'iwb-navrail-group' },
|
||||
item('help', 'help', '帮助', false, onHelp),
|
||||
item('hotkeys', 'circle-dot', '快捷键', false, onHotkeys),
|
||||
item('skin', skinIcon, '切换主题', false, onSkin),
|
||||
item('settings', 'settings', '设置', false, onSettings),
|
||||
item('more', 'more', '更多', false, onMore),
|
||||
global.document.body,
|
||||
)
|
||||
|
||||
return el(React.Fragment, null,
|
||||
el('nav', { className: 'iwb-navrail', 'aria-label': '一级导航' },
|
||||
el('div', { className: 'iwb-navrail-group' },
|
||||
item('home', 'home', '首页(画布库)', view === 'home', onHome),
|
||||
item('canvas', 'layer', '列表(画布工作区)', view === 'canvas', onCanvas),
|
||||
item('plugins', 'box', '插件', view === 'plugins', onPlugins),
|
||||
),
|
||||
el('div', { className: 'iwb-navrail-spacer' }),
|
||||
el('div', { className: 'iwb-navrail-group' },
|
||||
item('help', 'help', '帮助', false, onHelp),
|
||||
item('hotkeys', 'circle-dot', '快捷键', false, onHotkeys),
|
||||
item('skin', skinIcon, '切换主题', false, onSkin),
|
||||
item('settings', 'settings', '设置', false, onSettings),
|
||||
el('button', {
|
||||
key: 'more', type: 'button',
|
||||
className: 'iwb-nav-item iwb-nav-more-btn' + (update ? ' has-update' : '') + (moreOpen ? ' on' : ''),
|
||||
title: update ? ('发现新版本 v' + update.version + ',点击升级') : '更多',
|
||||
'aria-label': update ? '发现新版本,点击升级' : '更多',
|
||||
'aria-expanded': moreOpen ? 'true' : 'false',
|
||||
onPointerDown: (e) => e.stopPropagation(),
|
||||
onClick: (e) => { e.stopPropagation(); toggleMore(e) },
|
||||
}, update ? el(UpgradeIcon, null) : I('more')),
|
||||
),
|
||||
),
|
||||
menu,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,9 @@ function SetGroup (props) {
|
||||
}
|
||||
|
||||
function SettingsModal(props) {
|
||||
const [tab, setTab] = useState(props.initialTab || 'gen')
|
||||
// 2026-11-25:默认落「通用」(用户裁定)——此前默认 gen(生图服务),
|
||||
// 多数人打开设置是找通用项;initialTab 仍可由宿主显式指定(如顶部「内存」→ 诊断页)。
|
||||
const [tab, setTab] = useState(props.initialTab || 'general')
|
||||
// 诊断页「刷新」:重读崩溃记录后需要一个自增值触发重渲染。
|
||||
// 原来裸用 setDiagRev(从未声明)⇒ 点刷新会 ReferenceError。补上它就是原意。
|
||||
const [, setDiagRev] = useState(0)
|
||||
@@ -145,6 +147,7 @@ function SettingsModal(props) {
|
||||
const it = base.imageTransfer || { mode: 'base64', imageHost: { type: 'github', github: { owner: '', repo: '', branch: 'main', dir: 'tmp-refs', token: '', retentionHours: 24 }, imgbb: { key: '' }, generic: { uploadUrl: '', method: 'POST', auth: { type: 'none', token: '', headerName: '' }, fileField: 'image', urlPath: 'data.url', headers: {} } }, compression: { enabled: true, maxMB: 8, maxEdge: 2048, quality: 0.9, format: 'keep' } }
|
||||
return {
|
||||
providers: JSON.parse(JSON.stringify((base.providers || []).map((p) => ({ ...p, models: wNormalizeImageModels(p.models), layerModels: wNormalizeLayerModels(p.layerModels) })))),
|
||||
defaultGen: base.defaultGen ? JSON.parse(JSON.stringify(base.defaultGen)) : null,
|
||||
imgbbKey: '',
|
||||
imgbbMasked: (base.imgbb && base.imgbb.masked) || '',
|
||||
it: JSON.parse(JSON.stringify(it)),
|
||||
|
||||
+57
-21
@@ -687,8 +687,31 @@ function GSetGroup (props) {
|
||||
|
||||
function renderGeneralTab (ctx) {
|
||||
const { TASK_STALL_END_MAX, TASK_STALL_END_MIN, appVersion, draft, imageLibSection, setDraft } = ctx
|
||||
const DG = (typeof window !== 'undefined' && window.IWBDefaultGenModel) || null
|
||||
const dgOpts = DG ? DG.wDefaultGenOptions(draft) : []
|
||||
const dgNow = draft.defaultGen || {}
|
||||
const dgVal = dgNow.providerId + '::' + dgNow.model
|
||||
return el('div', { className: 'iwb-gset-page' },
|
||||
el(VersionBlock, { version: appVersion }),
|
||||
el(GSetGroup, { title: '新建配置节点' },
|
||||
el('div', { className: 'iwb-gset-row' },
|
||||
el('span', { className: 'iwb-gset-row-label' }, '默认模型'),
|
||||
el('div', { className: 'iwb-gset-row-ctl' },
|
||||
el('select', {
|
||||
className: 'iwb-input', 'aria-label': '新建配置节点默认模型',
|
||||
value: dgOpts.some((o) => o.providerId + '::' + o.model === dgVal) ? dgVal : '',
|
||||
onChange: (e) => {
|
||||
const hit = dgOpts.find((o) => o.providerId + '::' + o.model === e.target.value)
|
||||
setDraft((d) => ({ ...d, defaultGen: hit ? { providerId: hit.providerId, model: hit.model, keyGroup: hit.keyGroup } : null }))
|
||||
},
|
||||
},
|
||||
el('option', { value: '' }, '未设置(用系统默认)'),
|
||||
dgOpts.map((o) => el('option', { key: o.providerId + '::' + o.model, value: o.providerId + '::' + o.model }, o.label)),
|
||||
),
|
||||
),
|
||||
),
|
||||
el('div', { className: 'iwb-gset-hint' }, '新建「配置」节点时预选这里选的模型;删除或关闭该模型后自动回退到主服务第一个启用的模型。已有节点不受影响。'),
|
||||
),
|
||||
isDesk() ? el(DownloadDirBlock, null) : el(GSetGroup, { title: '数据与目录' }, el(DataDirRow, null),
|
||||
),
|
||||
el(GSetGroup, { title: '图片与图库' }, imageLibSection || null,
|
||||
@@ -969,6 +992,8 @@ function GSetGroup (props) {
|
||||
const { DEFAULT_SHAPE_TPL, I, W_SHAPE_KINDS, addAddr, addKey, addLayerModel, addModel, addProvider, api, delAddr, delKey, delLayerModel, delModel, delProv, draft, layerModelInput, makeProviderDefault, modelInput, modelSupportsQuality, provSel, setAddr, setDefault, setKey, setLayerModelInput, setModelInput, setModelKind, setModelQuality, setProv, setProvSel, setShapeText, shapeText, speed, speedTest, toggleLayerModel, toggleModel, wNormalizeLayerModels, wPrivateToolsOn } = ctx
|
||||
const provCards = []
|
||||
const providersAll = draft.providers || []
|
||||
const DGM = (typeof window !== 'undefined' && window.IWBDefaultGenModel) || null
|
||||
const dgEff = DGM ? DGM.wResolveDefaultGen(draft) : null
|
||||
const selectedId = provSel && providersAll.some((p) => p.id === provSel) ? provSel : ((providersAll[0] && providersAll[0].id) || '')
|
||||
const chips = el('div', { className: 'iwb-prov-chips', role: 'tablist', 'aria-label': '服务商' },
|
||||
providersAll.map((p, i) => el('button', {
|
||||
@@ -1061,11 +1086,16 @@ function GSetGroup (props) {
|
||||
shapeMore,
|
||||
)
|
||||
const sp = speed && speed.providerId === p.id ? speed : null
|
||||
const modelRows = (p.models || []).map((m) => el('div', { key: m.name, className: 'iwb-modelrow' },
|
||||
el('label', { className: 'iwb-check iwb-modelrow-main', title: m.name + '(勾选=在生图节点下拉里可见)' },
|
||||
const modelRows = (p.models || []).map((m) => {
|
||||
const isDefault = !!(dgEff && dgEff.providerId === p.id && dgEff.model === m.name)
|
||||
return el('div', { key: m.name, className: 'iwb-modelrow' + (isDefault ? ' iwb-modelrow-active iwb-modelrow-default' : '') },
|
||||
// 2026-11-25:启用改为圆角开关(沿用通用 .iwb-switch),checkbox 仍在 DOM 内(隐藏)以兼容既有选择器。
|
||||
el('label', { className: 'iwb-switch iwb-modelrow-main', title: m.name + '(开启=在生图节点下拉里可见)' },
|
||||
el('input', { type: 'checkbox', checked: m.visible !== false, onChange: (e) => toggleModel(pi, m.name, e.target.checked) }, null),
|
||||
el('span', { className: 'iwb-switch-track' }, el('span', { className: 'iwb-switch-dot' }, null)),
|
||||
el('span', { className: 'iwb-modelrow-name', title: m.name }, m.name),
|
||||
),
|
||||
isDefault ? el('span', { className: 'iwb-modelrow-defmark' }, '默认') : null,
|
||||
// v3.87.31:「质量」用**胶囊样式**(复选框仍在 DOM 内且可见,兼容既有测试选择器;点亮=支持质量档位)
|
||||
el('label', {
|
||||
className: 'iwb-modelrow-q iwb-quality-toggle' + (modelSupportsQuality(p, m.name) ? ' on' : ''),
|
||||
@@ -1091,30 +1121,34 @@ function GSetGroup (props) {
|
||||
el('option', { value: 'doubao' }, 'doubao'),
|
||||
el('option', { value: 'custom' }, 'custom'),
|
||||
),
|
||||
el('details', { className: 'iwb-model-more' },
|
||||
el('summary', { className: 'iwb-model-more-btn', title: '更多操作', 'aria-label': '更多操作 ' + m.name }, '⋯'),
|
||||
el('div', { className: 'iwb-ctxmenu iwb-model-more-menu' },
|
||||
m.source !== 'builtin'
|
||||
? el('button', { className: 'iwb-model-more-del', title: '删除模型', 'aria-label': '删除模型 ' + m.name, onClick: () => delModel(pi, m.name) }, '删除模型')
|
||||
: el('div', { className: 'iwb-model-more-hint' }, '内置模型不可删除'),
|
||||
),
|
||||
),
|
||||
))
|
||||
// 2026-11-25:删除从「⋯ 更多」里提到行内垃圾桶按钮(用户裁定)。
|
||||
// 内置模型保留按钮但禁用,title 说明原因——比藏掉更能解释「为什么不能删」。
|
||||
el('button', {
|
||||
type: 'button', className: 'iwb-model-del',
|
||||
title: m.source === 'builtin' ? '内置模型不可删除' : '删除模型',
|
||||
'aria-label': '删除模型 ' + m.name,
|
||||
disabled: m.source === 'builtin',
|
||||
onPointerDown: (e) => e.stopPropagation(),
|
||||
onClick: (e) => { e.stopPropagation(); if (m.source !== 'builtin') delModel(pi, m.name) },
|
||||
}, I('trash')),
|
||||
)
|
||||
})
|
||||
// 分层模型行:结构与生图模型行一致(同一套 .iwb-modellist/.iwb-modelrow 样式);
|
||||
// 内置项既不能删也不能隐藏(隐藏会让分层节点没有模型可选)。
|
||||
const layerModelRows = wNormalizeLayerModels(p.layerModels).map((m) => el('div', { key: 'L:' + m.name, className: 'iwb-modelrow' },
|
||||
el('label', { className: 'iwb-check iwb-modelrow-main' },
|
||||
el('label', { className: 'iwb-switch iwb-modelrow-main', title: m.source === 'builtin' ? '内置分层模型,始终可用' : '开启=在分层节点里可见' },
|
||||
el('input', { type: 'checkbox', checked: true, disabled: m.source === 'builtin', onChange: (e) => toggleLayerModel(pi, m.name, e.target.checked) }, null),
|
||||
el('span', null, m.name),
|
||||
),
|
||||
el('details', { className: 'iwb-model-more' },
|
||||
el('summary', { className: 'iwb-model-more-btn', title: '更多操作', 'aria-label': '更多操作 ' + m.name }, '⋯'),
|
||||
el('div', { className: 'iwb-ctxmenu iwb-model-more-menu' },
|
||||
m.source !== 'builtin'
|
||||
? el('button', { className: 'iwb-model-more-del', title: '删除分层模型', 'aria-label': '删除分层模型 ' + m.name, onClick: () => delLayerModel(pi, m.name) }, '删除分层模型')
|
||||
: el('div', { className: 'iwb-model-more-hint' }, '内置分层模型不可删除'),
|
||||
),
|
||||
el('span', { className: 'iwb-switch-track' }, el('span', { className: 'iwb-switch-dot' }, null)),
|
||||
el('span', { className: 'iwb-modelrow-name', title: m.name }, m.name),
|
||||
),
|
||||
el('button', {
|
||||
type: 'button', className: 'iwb-model-del',
|
||||
title: m.source === 'builtin' ? '内置分层模型不可删除' : '删除分层模型',
|
||||
'aria-label': '删除分层模型 ' + m.name,
|
||||
disabled: m.source === 'builtin',
|
||||
onPointerDown: (e) => e.stopPropagation(),
|
||||
onClick: (e) => { e.stopPropagation(); if (m.source !== 'builtin') delLayerModel(pi, m.name) },
|
||||
}, I('trash')),
|
||||
))
|
||||
provCards.push(el('div', { key: p.id, className: 'iwb-provider-card' },
|
||||
el(GSetGroup, { title: '服务' },
|
||||
@@ -1273,8 +1307,10 @@ function GSetGroup (props) {
|
||||
models: wNormalizeImageModels(p.models),
|
||||
layerModels: wNormalizeLayerModels(p.layerModels),
|
||||
}, wShapeProviderFields(p)))
|
||||
const DG = (typeof window !== 'undefined' && window.IWBDefaultGenModel) || null
|
||||
const res = await api('config', {
|
||||
providers,
|
||||
defaultGen: DG ? DG.wNormalizeDefaultGen({ providers }, draft.defaultGen) : (draft.defaultGen || null),
|
||||
imgbbKey: (draft.imgbbKey && draft.imgbbKey.trim()) || '__KEEP__',
|
||||
imageTransfer: draft.it,
|
||||
outputsRetention: draft.retention,
|
||||
|
||||
@@ -1598,11 +1598,13 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
/* v3.87.31 模型清单:名称占位更宽 + 「质量」胶囊开关(与"启用"复选框区分) */
|
||||
.iwb-modelrow { flex: 1 1 460px; }
|
||||
.iwb-modelrow-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 120px; }
|
||||
.iwb-quality-toggle { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--iwb-border); background: transparent; color: var(--iwb-text-dim); border-radius: 999px; padding: 1px 9px; font: inherit; font-size: 12px; line-height: 18px; cursor: pointer; }
|
||||
.iwb-quality-toggle input { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; border: 1px solid currentColor; border-radius: 3px; margin: 0; position: relative; }
|
||||
.iwb-quality-toggle input:checked::after { content: ''; position: absolute; inset: 2px; background: currentColor; border-radius: 1px; }
|
||||
.iwb-quality-toggle:hover { border-color: var(--iwb-brand); }
|
||||
.iwb-quality-toggle.on { border-color: var(--iwb-brand); color: var(--iwb-brand-text, var(--iwb-brand)); font-weight: 600; background: color-mix(in srgb, var(--iwb-brand) 12%, transparent); }
|
||||
/* 2026-11-25:质量去外框复选框,仅用胶囊底色 + 文字区分开关;input 透明覆盖整枚胶囊,
|
||||
既去掉小方框又保留 DOM 可见尺寸(e2e 的 .check() 依赖元素可点击)。 */
|
||||
.iwb-quality-toggle { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; border: 0; background: transparent; color: var(--iwb-text-dim); border-radius: var(--iwb-radius-full); padding: var(--iwb-space-4) var(--iwb-space-10); font: inherit; font-size: var(--iwb-font-sm); line-height: 18px; cursor: pointer; }
|
||||
.iwb-quality-toggle input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
|
||||
.iwb-settings-modal .iwb-quality-toggle input { width: 100%; height: 100%; border-radius: var(--iwb-radius-full); }
|
||||
.iwb-quality-toggle:hover { background: var(--iwb-hover); }
|
||||
.iwb-quality-toggle.on { color: var(--iwb-brand-text, var(--iwb-brand)); font-weight: 600; background: color-mix(in srgb, var(--iwb-brand) 12%, transparent); }
|
||||
.iwb-shape-hint { flex: 1 1 100%; margin-top: 2px; }
|
||||
|
||||
/* v3.87.39 顶部状态栏:加半透明白底 + 背景模糊,避免叠在图片/内容上时文字看不清 */
|
||||
@@ -2159,6 +2161,11 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
旧暗色是 #e0e0e0 底 + var(--iwb-text) 字,实测 1.3:1(白底白字)。 */
|
||||
.iwb-nav-item.on { background: var(--iwb-text); color: var(--iwb-bg); }
|
||||
.iwb-nav-item.on:hover { background: color-mix(in srgb, var(--iwb-text) 88%, var(--iwb-bg)); }
|
||||
/* 底部「更多」:有新版本时 ⋯ → 圆形上箭头,强调色提示可升级 */
|
||||
.iwb-nav-more-btn.has-update { color: var(--iwb-brand-text); }
|
||||
.iwb-nav-more-btn.has-update .iwb-ic { color: var(--iwb-brand-text); }
|
||||
.iwb-nav-more-up { color: var(--iwb-brand-text); font-weight: 600; }
|
||||
.iwb-nav-more-ver { padding: var(--iwb-space-6) var(--iwb-space-8); font-size: var(--iwb-font-xs); color: var(--iwb-text2); user-select: none; }
|
||||
.ws-expanded .iwb-navrail { width: 52px; }
|
||||
|
||||
/* ── 插件整页(v3.25.59)──────────────────────────────────────────────── */
|
||||
@@ -2376,15 +2383,21 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
.iwb-settings-modal .iwb-input,.iwb-settings-modal .iwb-textarea{border-color:var(--iwb-set-input-border)}
|
||||
.iwb-settings-modal .iwb-input:focus,.iwb-settings-modal .iwb-textarea:focus{border-color:var(--iwb-brand)}
|
||||
|
||||
/* 模型行:删除收进「⋯」更多菜单,防误触 */
|
||||
.iwb-model-more{position:relative;display:inline-flex;flex:0 0 auto}
|
||||
.iwb-model-more>summary{list-style:none;cursor:pointer;width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--iwb-radius-control);color:var(--iwb-text2);font-size:var(--iwb-font-lg);line-height:1}
|
||||
.iwb-model-more>summary::-webkit-details-marker{display:none}
|
||||
.iwb-model-more>summary:hover{background:var(--iwb-hover)}
|
||||
.iwb-model-more-menu{position:absolute!important;right:0;left:auto;top:calc(100% + var(--iwb-space-4));min-width:132px;max-width:none;max-height:none;overflow:visible;padding:var(--iwb-space-4);border-radius:var(--iwb-radius-control)}
|
||||
.iwb-model-more-del{width:100%;text-align:left;border:0;background:transparent;color:var(--iwb-err);font-size:var(--iwb-font-sm);padding:var(--iwb-space-6) var(--iwb-space-8);border-radius:var(--iwb-radius-chip);cursor:pointer}
|
||||
.iwb-model-more-del:hover{background:color-mix(in srgb,var(--iwb-err) 10%,transparent)}
|
||||
.iwb-model-more-hint{padding:var(--iwb-space-6) var(--iwb-space-8);font-size:var(--iwb-font-xs);color:var(--iwb-text2)}
|
||||
/* 模型行:启用=圆角开关(复用 .iwb-switch,26×15 小型;checkbox 仍在 DOM 内兼容选择器)。
|
||||
删除=行内垃圾桶按钮(2026-11-25 用户裁定:取消 ⋯ 菜单,一步到位)。
|
||||
沿用 iwb-btn-danger 的「悬停才显形」契约,避免误触;内置模型 disabled 常隐。 */
|
||||
.iwb-modelrow .iwb-switch-track{width:26px;height:15px}
|
||||
.iwb-modelrow .iwb-switch-dot{width:11px;height:11px;top:2px;left:2px}
|
||||
.iwb-modelrow .iwb-switch input:checked + .iwb-switch-track .iwb-switch-dot{transform:translateX(11px)}
|
||||
.iwb-modelrow .iwb-modelrow-main{min-width:0;flex:1 1 auto;gap:var(--iwb-space-8)}
|
||||
.iwb-modelrow .iwb-modelrow-name{flex:1 1 auto;min-width:0}
|
||||
.iwb-modelrow-defmark{flex:0 0 auto;font-size:var(--iwb-font-xs);color:var(--iwb-text-dim);border-radius:var(--iwb-radius-full);padding:var(--iwb-space-2) var(--iwb-space-8);background:var(--iwb-layer2)}
|
||||
.iwb-settings-modal .iwb-modelrow-default{border-color:var(--iwb-brand);background:color-mix(in srgb,var(--iwb-brand) 8%,transparent)}
|
||||
.iwb-model-del{flex:0 0 auto;width:26px;height:26px;display:inline-flex;align-items:center;justify-content:center;border:0;background:transparent;border-radius:var(--iwb-radius-control);color:var(--iwb-err);cursor:pointer;opacity:0;pointer-events:none;transition:opacity .15s ease}
|
||||
.iwb-modelrow:hover .iwb-model-del,.iwb-modelrow:focus-within .iwb-model-del{opacity:1;pointer-events:auto}
|
||||
.iwb-model-del:hover:not(:disabled){background:var(--iwb-err-bg)}
|
||||
.iwb-model-del .iwb-ic{width:var(--iwb-icon-sm);height:var(--iwb-icon-sm)}
|
||||
.iwb-model-del:disabled{cursor:default;opacity:0!important;pointer-events:none}
|
||||
|
||||
/* 设置页统一:所有分组块间距只允许用 --iwb-set-group-gap */
|
||||
.iwb-settings-modal .iwb-provider-card{gap:var(--iwb-set-group-gap)}
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
"IWBCanvasStore",
|
||||
"IWBCanvasText",
|
||||
"IWBCrashLog",
|
||||
"IWBDefaultGenModel",
|
||||
"IWBDesktop",
|
||||
"IWBDesktopHelpers",
|
||||
"IWBDockArea",
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"runtime-crash-log.js",
|
||||
"storage-health.js",
|
||||
"storage-config-shape.js",
|
||||
"generation-default-model.js",
|
||||
"storage-indexeddb.js",
|
||||
"storage-workspace.js",
|
||||
"storage-groups.js",
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
'use strict'
|
||||
|
||||
// src/generation-default-model.js 行为契约(2026-11-25)
|
||||
// 守的是「新建配置节点默认模型」的三条铁律:未配置零变化 / 有效配置照用 / 失效回退主服务首个。
|
||||
const assert = require('assert')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const vm = require('vm')
|
||||
|
||||
const root = path.resolve(__dirname, '..')
|
||||
const box = { console: { log() {}, warn() {}, error() {} } }
|
||||
vm.runInNewContext(fs.readFileSync(path.join(root, 'src', 'generation-default-model.js'), 'utf8'), box)
|
||||
const M = box.IWBDefaultGenModel
|
||||
assert.ok(M && typeof M.wResolveDefaultGen === 'function', '应导出 IWBDefaultGenModel.wResolveDefaultGen')
|
||||
|
||||
const eq = (a, b, msg) => assert.strictEqual(JSON.stringify(a), JSON.stringify(b), msg)
|
||||
|
||||
const cfg = {
|
||||
providers: [
|
||||
{ id: 'p1', name: '主服务', keys: [{ id: 'k1' }, { id: 'k1b' }], models: [{ name: 'm1', visible: true }, { name: 'm2', visible: false }, { name: 'm1', visible: true }] },
|
||||
{ id: 'p2', name: '备用', keys: [{ id: 'k2' }], models: [{ name: 'm3', visible: true }] },
|
||||
],
|
||||
}
|
||||
|
||||
eq(M.wDefaultGenOptions(cfg).map((o) => o.label), ['主服务 · m1', '备用 · m3'], '选项只含可见模型、去重保序,标签=服务名 · 模型名')
|
||||
|
||||
eq(M.wResolveDefaultGen(cfg), null, '未配置 ⇒ null(宿主保留硬编码,存量行为零变化)')
|
||||
eq(M.wResolveDefaultGen({ ...cfg, defaultGen: { providerId: 'p2', model: 'm3' } }),
|
||||
{ providerId: 'p2', model: 'm3', keyGroup: 'k2' }, '有效配置照用,keyGroup 取该服务首个 Key')
|
||||
eq(M.wResolveDefaultGen({ ...cfg, defaultGen: { providerId: 'p1', model: 'm1', keyGroup: '自定义组' } }),
|
||||
{ providerId: 'p1', model: 'm1', keyGroup: '自定义组' }, '有效配置保留用户显式 keyGroup')
|
||||
eq(M.wResolveDefaultGen({ ...cfg, defaultGen: { providerId: 'p1', model: 'm2' } }),
|
||||
{ providerId: 'p1', model: 'm1', keyGroup: 'k1' }, '配置的模型被关闭 ⇒ 回退主服务首个可见模型')
|
||||
eq(M.wResolveDefaultGen({ ...cfg, defaultGen: { providerId: 'pX', model: 'gone' } }),
|
||||
{ providerId: 'p1', model: 'm1', keyGroup: 'k1' }, '服务被删 ⇒ 同样回退主服务首个')
|
||||
eq(M.wResolveDefaultGen({ providers: [], defaultGen: { providerId: 'p1', model: 'm1' } }), null, '无可用模型 ⇒ null')
|
||||
|
||||
eq(M.wNormalizeDefaultGen(cfg, { providerId: 'p2', model: 'm3' }),
|
||||
{ providerId: 'p2', model: 'm3', keyGroup: 'k2' }, '归一化接受有效项')
|
||||
eq(M.wNormalizeDefaultGen(cfg, { providerId: 'p1', model: 'm2' }), null, '归一化拒绝不可见模型(让读取侧走回退)')
|
||||
eq(M.wNormalizeDefaultGen(cfg, null), null, '空值归一化为 null')
|
||||
|
||||
console.log('generation-default-model checks passed(未配置零变化 / 有效照用 / 失效回退 / 保存校验)')
|
||||
@@ -0,0 +1,102 @@
|
||||
// 通用 → 新建配置节点「默认模型」:设置 → 保存 → 新建节点预选 → 模型行默认标识(2026-11-25)
|
||||
const { test, expect } = require('./_pw-coverage')
|
||||
|
||||
const baseURL = process.env.IWB_BASE_URL || 'http://127.0.0.1:8787'
|
||||
test.use({ baseURL, viewport: { width: 1600, height: 1100 } })
|
||||
|
||||
const CFG = {
|
||||
providers: [{
|
||||
id: 'p-def', name: '默认服务', baseUrl: 'https://def.example/v1',
|
||||
keys: [{ id: 'k-1', name: 'K', value: 'sk-test' }],
|
||||
models: [{ id: 'm-1', name: 'model-alpha' }, { id: 'm-2', name: 'model-beta' }],
|
||||
}],
|
||||
canvas: {},
|
||||
}
|
||||
|
||||
const WS = {
|
||||
workspaces: [{ id: 'w1', name: 'W', nodes: [], edges: [], groups: [] }],
|
||||
activeId: 'w1', rev: 1,
|
||||
}
|
||||
|
||||
const readCfg = (page) => page.evaluate(() => {
|
||||
const raw = localStorage.getItem('iwb_web_cfg')
|
||||
return raw ? JSON.parse(raw) : {}
|
||||
})
|
||||
|
||||
async function enterCanvas (page, cfg) {
|
||||
await page.addInitScript((d) => {
|
||||
localStorage.clear()
|
||||
localStorage.setItem('iwb_web_cfg', JSON.stringify(d.cfg))
|
||||
localStorage.setItem('iwb_web_workspaces', JSON.stringify(d.ws))
|
||||
localStorage.setItem('iwb_ws_active', d.ws.activeId)
|
||||
localStorage.setItem('iwb_ws_w1', JSON.stringify(d.ws.workspaces[0]))
|
||||
localStorage.setItem('iwb_web_outputs', JSON.stringify([]))
|
||||
}, { cfg: cfg || CFG, ws: WS })
|
||||
await page.goto('/', { waitUntil: 'domcontentloaded' })
|
||||
await page.waitForTimeout(700)
|
||||
await page.locator('.iwb-home-card:not(.iwb-home-new)').first().dblclick()
|
||||
await expect(page.locator('.iwb-canvas:not(.iwb-canvas-hidden)')).toBeVisible()
|
||||
}
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
const errors = []
|
||||
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)))
|
||||
page.__errors = errors
|
||||
})
|
||||
|
||||
test('通用 tab 选默认模型 → 保存 → 新建配置节点预选该模型', async ({ page }) => {
|
||||
await enterCanvas(page)
|
||||
// 打开设置(默认就是通用 tab)
|
||||
await page.locator('.iwb-nav-item[title="设置"]').first().click()
|
||||
const modal = page.locator('.iwb-settings-modal')
|
||||
await expect(modal).toBeVisible()
|
||||
await modal.locator('.iwb-set-nav-item', { hasText: '通用' }).first().click()
|
||||
|
||||
// ① 新分组在通用 tab,下拉可选项 = 全部启用模型
|
||||
const sel = modal.locator('select[aria-label="新建配置节点默认模型"]')
|
||||
await expect(sel).toBeVisible()
|
||||
await expect(sel.locator('option')).toHaveCount(3) // 未设置 + 2 模型
|
||||
await expect(sel.locator('option', { hasText: '默认服务 · model-beta' })).toHaveCount(1)
|
||||
|
||||
// ② 选 model-beta → 保存
|
||||
await sel.selectOption({ label: '默认服务 · model-beta' })
|
||||
await modal.locator('button:has-text("保存配置")').click()
|
||||
await expect(modal.getByText('已保存')).toBeVisible()
|
||||
await expect.poll(async () => {
|
||||
const c = await readCfg(page)
|
||||
return c.defaultGen && c.defaultGen.model
|
||||
}, { timeout: 10000 }).toBe('model-beta')
|
||||
|
||||
// ③ 关闭设置 → 新建配置节点 → 模型预选为 model-beta
|
||||
const closeBtn = page.locator('.iwb-modal-head button[title="关闭"]')
|
||||
if (await closeBtn.count()) await closeBtn.click()
|
||||
const canvas = page.locator('.iwb-canvas:not(.iwb-canvas-hidden)')
|
||||
const box = await canvas.boundingBox()
|
||||
await canvas.click({ button: 'right', position: { x: Math.round(box.width / 2), y: Math.round(box.height / 2) } })
|
||||
const ctx = page.locator('.iwb-ctxmenu:not(.iwb-ctx-sub)')
|
||||
await expect(ctx).toBeVisible({ timeout: 8000 })
|
||||
const genItem = ctx.locator('.iwb-ctx-item', { hasText: '配置' }).first()
|
||||
await expect(genItem).toBeVisible({ timeout: 8000 })
|
||||
await genItem.click()
|
||||
const pick = page.locator('.iwb-pick-genmodel').first()
|
||||
await expect(pick).toBeVisible({ timeout: 8000 })
|
||||
await expect(pick).toContainText('model-beta')
|
||||
|
||||
expect(page.__errors, '不应有页面异常').toEqual([])
|
||||
})
|
||||
|
||||
test('默认模型行有「默认」标识且带高亮描边', async ({ page }) => {
|
||||
await enterCanvas(page, { ...CFG, defaultGen: { providerId: 'p-def', model: 'model-beta', keyGroup: 'k-1' } })
|
||||
|
||||
await page.locator('.iwb-nav-item[title="设置"]').first().click()
|
||||
const modal = page.locator('.iwb-settings-modal')
|
||||
await modal.locator('.iwb-set-nav-item', { hasText: '生图服务' }).first().click()
|
||||
await expect(page.locator('.iwb-prov-chip').first()).toBeVisible({ timeout: 10000 })
|
||||
|
||||
const rows = page.locator('.iwb-modelrow')
|
||||
const beta = rows.filter({ hasText: 'model-beta' }).first()
|
||||
const alpha = rows.filter({ hasText: 'model-alpha' }).first()
|
||||
await expect(beta.locator('.iwb-modelrow-defmark')).toHaveText('默认')
|
||||
await expect(beta).toHaveClass(/iwb-modelrow-default/)
|
||||
await expect(alpha.locator('.iwb-modelrow-defmark')).toHaveCount(0)
|
||||
})
|
||||
@@ -150,9 +150,13 @@ test('设置里手动勾选「质量」并保存:节点即可选档位并发
|
||||
await seed(page, 'gpt-image-2', CFG_PLAIN)
|
||||
|
||||
// 打开设置 → 生图服务:默认**一个都没勾**(含 gpt-image-2.5),勾选完全手动
|
||||
await page.locator('.iwb-top-nav-icon[title="服务与 Key 设置"]').click()
|
||||
const nav = page.locator('.iwb-nav-item[title="设置"]')
|
||||
if (await nav.count() > 0) await nav.first().click()
|
||||
else await page.locator('[title="服务与 Key 设置"]').first().click()
|
||||
const modal = page.locator('.iwb-settings-modal')
|
||||
await expect(modal).toBeVisible()
|
||||
// 设置默认打开「通用」标签(2026-11-25 用户裁定)→ 显式切到生图服务
|
||||
await modal.locator('.iwb-set-nav-item', { hasText: '生图服务' }).first().click()
|
||||
await expect(modal.locator('.iwb-modelrow-q input[aria-label="支持质量 gpt-image-2.5"]')).not.toBeChecked()
|
||||
const q = modal.locator('.iwb-modelrow-q input[aria-label="支持质量 gpt-image-2"]')
|
||||
await expect(q).not.toBeChecked()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
// 选择器依据实际 DOM(2026-11-10 探针确认):
|
||||
// · 渠道卡片 .iwb-provider-card;删除渠道 = 文案「删除服务」
|
||||
// · 模型行 .iwb-modelrow;删除模型 = title「删除模型」(aria-label 带模型名)
|
||||
// · 模型行 .iwb-modelrow;删除模型 = 行内垃圾桶按钮 title「删除模型」(aria-label 带模型名)
|
||||
// · 添加模型 = 模型输入框所在行里的按钮(输入框 placeholder「手动添加模型名」)
|
||||
const { test, expect } = require('./_pw-coverage')
|
||||
|
||||
@@ -33,6 +33,8 @@ async function openSettings (page) {
|
||||
]
|
||||
for (const c of cands) if (await c.count() > 0) { await c.first().click(); break }
|
||||
}
|
||||
// 设置默认打开「通用」标签(2026-11-25 用户裁定)→ 生图服务的用例需显式切过去
|
||||
await page.locator('.iwb-set-nav-item', { hasText: '生图服务' }).first().click()
|
||||
await expect(page.locator('.iwb-prov-chip').first()).toBeVisible({ timeout: 10000 })
|
||||
}
|
||||
|
||||
@@ -103,8 +105,8 @@ test('② 模型可新增与删除,且改动会写入配置', async ({ page })
|
||||
await expect(rows).toHaveCount(2, { timeout: 8000 })
|
||||
|
||||
// 删除刚加的 → 回到 1 行
|
||||
await card.locator('.iwb-model-more-btn').last().click()
|
||||
await card.locator('[title="删除模型"]').last().click()
|
||||
// 2026-11-25:删除从 ⋯ 菜单提到行内垃圾桶按钮,一步点掉(内置模型该按钮 disabled,这里取自定义模型的)
|
||||
await card.locator('button.iwb-model-del[title="删除模型"]').last().click()
|
||||
await expect(rows).toHaveCount(1, { timeout: 8000 })
|
||||
|
||||
// 再加一次并保存 → 配置里应含新模型(同时验证"删了再加"不会把列表搞坏)
|
||||
|
||||
@@ -25,6 +25,8 @@ test('设置里可配厂商类型 / 自定义模板 / 模型级覆盖', async ({
|
||||
expect(opened, '应能找到设置入口').toBe(true)
|
||||
}
|
||||
await page.waitForTimeout(700)
|
||||
// 设置默认打开「通用」标签(2026-11-25 用户裁定)→ 显式切到生图服务
|
||||
await page.locator('.iwb-set-nav-item', { hasText: '生图服务' }).first().click()
|
||||
const kindSel = page.locator('select[aria-label="厂商类型"]').first()
|
||||
await expect(kindSel).toBeVisible()
|
||||
await expect(kindSel).toHaveValue('openai')
|
||||
|
||||
@@ -32,7 +32,8 @@ assert.deepStrictEqual(specsBase, expectedSpecs, '门禁 spec 必须等于全部
|
||||
// 55 = 54 + iwb-multi-tab(v3.24.85:跨标签页契约 —— A 页 flush 落盘后 B 页靠 rev 轮询可见 / 图库归档受跨进程锁保护)
|
||||
// 53 = 55 − iwb-csp-gate − iwb-functions-headers(v3.25.15:网页版部署面删除,两条只测 _headers/Functions 的 spec 一并删除)
|
||||
// 52 = 53 − iwb-groups-sidebar(v3.25.56 节点组库改为插件 grouplib,宿主侧栏组件删除,其 e2e 一并移除)
|
||||
assert.strictEqual(result.specs.length, 52, '当前门禁应自动发现 52 个 spec')
|
||||
// 53 = 52 + iwb-default-gen-model(v3.26.71:通用 tab 设置新建配置节点默认模型)
|
||||
assert.strictEqual(result.specs.length, 53, '当前门禁应自动发现 53 个 spec')
|
||||
// 排除集合 = 全部人工 dev 探针,且都必须已声明标记
|
||||
// 4 = 3 + _probe-tab-switch(切画布标签耗时归因:四轮对照实验,只读诊断)
|
||||
// 5 = 4 + _visual-tokens(设计 token 视觉基线:像素受字体/DPR 影响,不入 CI,本地 0 diff 验收用)
|
||||
|
||||
Vendored
+1
@@ -64,6 +64,7 @@ interface Window {
|
||||
IWBGenerationSizePolicy?: any
|
||||
IWBGenerationState?: any
|
||||
IWBGenerationTaskGraph?: any
|
||||
IWBDefaultGenModel?: any
|
||||
IWBGalleryHydration?: any
|
||||
IWBGalleryQuery?: any
|
||||
// 运行时
|
||||
|
||||
Reference in new issue
Block a user