dsh-mo-image 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/LICENSE +34 -0
- package/README.md +12 -9
- package/lib/adapters/openai.js +56 -2
- package/lib/adapters.js +67 -32
- package/lib/client.js +207 -200
- package/lib/comfy-workflow.js +265 -58
- package/lib/config-store.js +14 -2
- package/lib/image-jobs.js +2 -2
- package/lib/image-queue.js +1 -1
- package/lib/image-worker.js +1 -1
- package/lib/index.js +14 -4
- package/lib/model-rules.js +7 -0
- package/lib/prompt-profiles.js +8 -0
- package/lib/status.js +31 -8
- package/lib/update-service.js +11 -13
- package/lib/update.js +17 -34
- package/locale/messages.csv +8 -9
- package/package.json +1 -2
- package/skills/mo-image-editing/SKILL.md +2 -1
- package/THIRD-PARTY-NOTICES.md +0 -32
package/lib/status.js
CHANGED
|
@@ -8,29 +8,52 @@
|
|
|
8
8
|
* 纯函数,不发请求、不写配置;凭据由调用方(index.js)解析后以 key 传入。
|
|
9
9
|
*/
|
|
10
10
|
import { adapterSupportsKind, resolveAdapter, sizeSpecFor } from './adapters.js';
|
|
11
|
+
import { parseWorkflow, workflowImageSlots, workflowReferenceTarget, WORKFLOW_REFERENCE_LIMIT } from './comfy-workflow.js';
|
|
11
12
|
|
|
12
13
|
export const STATUS_CONTRACT = 1;
|
|
13
14
|
/** mo-image 工具一次最多接受的参考图数量(与 lib/index.js 的 MAX_REF_COUNT 对齐)。 */
|
|
14
|
-
export const MAX_REFS =
|
|
15
|
+
export const MAX_REFS = WORKFLOW_REFERENCE_LIMIT;
|
|
15
16
|
|
|
16
17
|
function adapterFor(provider, model) {
|
|
17
18
|
try { return resolveAdapter(provider, model); } catch (_error) { return null; }
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
const workflowEditCache = new WeakMap();
|
|
22
|
+
const SINGLE_REFERENCE = { count: 1, slots: [] };
|
|
23
|
+
|
|
24
|
+
export function comfyReferencePlan(entry) {
|
|
25
|
+
const workflow = String(entry?.workflow || '');
|
|
26
|
+
if (!workflow) return SINGLE_REFERENCE;
|
|
27
|
+
const image = entry.mapping?.image;
|
|
28
|
+
const cached = workflowEditCache.get(entry);
|
|
29
|
+
if (cached?.workflow === workflow && cached.image === image) return cached.plan;
|
|
30
|
+
let plan = null;
|
|
31
|
+
try {
|
|
32
|
+
const parsed = parseWorkflow(workflow);
|
|
33
|
+
const graph = parsed.graph || Object.fromEntries(parsed.ui.nodes.filter(Boolean).map((node) => [
|
|
34
|
+
String(node.id), { class_type: node.type, _meta: { title: node.title }, inputs: { widgets: node.widgets_values } }
|
|
35
|
+
]));
|
|
36
|
+
const slots = workflow.includes('{{') ? workflowImageSlots(graph) : [];
|
|
37
|
+
const mapped = () => parsed.format === 'api' ? workflowReferenceTarget(graph, image)
|
|
38
|
+
: image && Object.hasOwn(graph, image.node);
|
|
39
|
+
if (slots.length) plan = { count: slots.length, slots };
|
|
40
|
+
else if (mapped()) plan = SINGLE_REFERENCE;
|
|
41
|
+
} catch (_error) {
|
|
42
|
+
// 无效工作流不会被列为可编辑模型。
|
|
43
|
+
}
|
|
44
|
+
workflowEditCache.set(entry, { workflow, image, plan });
|
|
45
|
+
return plan;
|
|
46
|
+
}
|
|
47
|
+
|
|
20
48
|
/**
|
|
21
49
|
* 当前模型能不能图生图。
|
|
22
|
-
* - ComfyUI
|
|
50
|
+
* - ComfyUI 由工作流决定:检查占位符、已保存绑定和 API 工作流的图像输入。
|
|
23
51
|
* - 异步入队型看 async.edit;普通适配器看 endpoints.edit。
|
|
24
52
|
*/
|
|
25
53
|
export function canEditModel(provider, model, adapter) {
|
|
26
54
|
if (!adapter) return false;
|
|
27
55
|
if (adapter.id === 'comfyui') {
|
|
28
|
-
|
|
29
|
-
const workflow = String(entry?.workflow || '');
|
|
30
|
-
if (!workflow) return true;
|
|
31
|
-
const hasSlot = /\{\{\s*image\s*\}\}/.test(workflow);
|
|
32
|
-
const mapped = Boolean(entry.mapping && entry.mapping.image);
|
|
33
|
-
return hasSlot || mapped;
|
|
56
|
+
return Boolean(comfyReferencePlan(provider?.modelOptions?.[model]));
|
|
34
57
|
}
|
|
35
58
|
const edit = adapter.operations?.edit;
|
|
36
59
|
if (edit?.fields?.image === null || edit?.fields?.image === false
|
package/lib/update-service.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* 更新状态服务:把「检查 npm → 有没有新版 → 装哪个版本 → 装完没有」
|
|
3
3
|
* 收成一个有状态对象,路由和启动预热都只跟它打交道。
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* 不碰 git,免得用户还要为 GitHub 单独准备网络和凭据。
|
|
5
|
+
* 从镜像检测新版,安装仍使用 npm 版本规格,并指定同一个镜像。
|
|
7
6
|
*
|
|
8
7
|
* 自我更新有个绕不开的坑:装新版本时插件自己会被卸载,这次调用等不到结果。
|
|
9
8
|
* 所以状态靠标记文件 + 当前版本号事后判定,见 hydrate()。
|
|
@@ -11,7 +10,7 @@
|
|
|
11
10
|
import { randomUUID } from 'node:crypto';
|
|
12
11
|
import {
|
|
13
12
|
classifySource, clearMarker, compareVersions, fetchChangelogNotes, fetchLatestVersion,
|
|
14
|
-
judgeMarker, readMarker, writeMarker
|
|
13
|
+
judgeMarker, readMarker, UPDATE_REGISTRY, writeMarker
|
|
15
14
|
} from './update.js';
|
|
16
15
|
|
|
17
16
|
// 宿主进程启动时刻:process.uptime 是进程年龄,模块重新 import 不会把它重置。
|
|
@@ -30,13 +29,13 @@ export const UPDATE_SPEC = (version) => `dsh-mo-image@${version}`;
|
|
|
30
29
|
* @param {() => number} [options.now]
|
|
31
30
|
* @param {(ms: number) => Promise<void>} [options.sleep]
|
|
32
31
|
* @param {number} [options.installDelayMs] 先让"正在更新"气泡露个脸
|
|
33
|
-
* @param {string} [options.
|
|
34
|
-
* @param {string} [options.releasesBase]
|
|
32
|
+
* @param {string} [options.registryBase] 检查与安装使用的 registry
|
|
35
33
|
*/
|
|
36
34
|
export function createUpdateService(options = {}) {
|
|
37
35
|
const currentVersion = String(options.currentVersion || '0.0.0');
|
|
38
36
|
const markerFile = typeof options.markerFile === 'string' ? options.markerFile : '';
|
|
39
37
|
const request = options.request;
|
|
38
|
+
const registry = options.registryBase || UPDATE_REGISTRY;
|
|
40
39
|
const pluginManager = options.pluginManager;
|
|
41
40
|
const log = typeof options.log === 'function' ? options.log : () => {};
|
|
42
41
|
const now = typeof options.now === 'function' ? options.now : Date.now;
|
|
@@ -74,7 +73,7 @@ export function createUpdateService(options = {}) {
|
|
|
74
73
|
return {
|
|
75
74
|
source: hit && typeof hit.source === 'string' ? hit.source : '',
|
|
76
75
|
// 只有以 npm 版本安装的包才能走 updateBundle(卸旧装新、失败自动装回)。
|
|
77
|
-
updatable:
|
|
76
|
+
updatable: hit?.update === 'registry' || hit?.updatable === true
|
|
78
77
|
};
|
|
79
78
|
} catch (_error) {
|
|
80
79
|
return { source: '', updatable: false };
|
|
@@ -113,8 +112,7 @@ export function createUpdateService(options = {}) {
|
|
|
113
112
|
updatable = bundle.updatable;
|
|
114
113
|
const release = await fetchLatestVersion({
|
|
115
114
|
request,
|
|
116
|
-
registryBase:
|
|
117
|
-
mirrorBase: options.mirrorBase,
|
|
115
|
+
registryBase: registry,
|
|
118
116
|
onError: (reason) => safeLog('update check failed: ' + String(reason || 'unknown'))
|
|
119
117
|
});
|
|
120
118
|
if (disposed) return;
|
|
@@ -198,8 +196,8 @@ export function createUpdateService(options = {}) {
|
|
|
198
196
|
const rollback = async (activeManager) => {
|
|
199
197
|
if (!previousSpec) return false;
|
|
200
198
|
try {
|
|
201
|
-
const restored = await activeManager.installBundle(previousSpec, { enabled: true });
|
|
202
|
-
const application = restored
|
|
199
|
+
const restored = await activeManager.installBundle(previousSpec, { enabled: true, registry });
|
|
200
|
+
const application = (restored?.result ?? restored)?.application;
|
|
203
201
|
return application !== 'failed' && application !== 'cancelled';
|
|
204
202
|
} catch (_error) {
|
|
205
203
|
return false;
|
|
@@ -225,10 +223,10 @@ export function createUpdateService(options = {}) {
|
|
|
225
223
|
let result;
|
|
226
224
|
if (updatable && typeof active.updateBundle === 'function') {
|
|
227
225
|
// npm 安装:走原生更新,它会在装失败时把旧版本装回来。
|
|
228
|
-
result = await active.updateBundle('dsh-mo-image', to, { requestId });
|
|
226
|
+
result = await active.updateBundle('dsh-mo-image', to, { requestId, registry });
|
|
229
227
|
} else {
|
|
230
228
|
const spec = UPDATE_SPEC(to);
|
|
231
|
-
const installOptions = { requestId, enabled: true };
|
|
229
|
+
const installOptions = { requestId, enabled: true, registry };
|
|
232
230
|
try {
|
|
233
231
|
result = await active.installBundle(spec, installOptions);
|
|
234
232
|
} catch (caught) {
|
|
@@ -238,7 +236,7 @@ export function createUpdateService(options = {}) {
|
|
|
238
236
|
result = await active.installBundle(spec, installOptions);
|
|
239
237
|
}
|
|
240
238
|
}
|
|
241
|
-
const application = result
|
|
239
|
+
const application = (result?.result ?? result)?.application;
|
|
242
240
|
if (application === 'failed' || application === 'cancelled') {
|
|
243
241
|
await fail(application);
|
|
244
242
|
return;
|
package/lib/update.js
CHANGED
|
@@ -7,6 +7,7 @@ import path from 'node:path';
|
|
|
7
7
|
|
|
8
8
|
export const REPO = 'CM-Silence/dsh-mo-image';
|
|
9
9
|
export const NPM_NAME = 'dsh-mo-image';
|
|
10
|
+
export const UPDATE_REGISTRY = 'https://registry.npmmirror.com';
|
|
10
11
|
|
|
11
12
|
const SEMVER = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
12
13
|
|
|
@@ -139,9 +140,6 @@ export function isHiddenPrerelease(version) {
|
|
|
139
140
|
return /-(?:a|b)\d+$/i.test(String(version || '').trim());
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
/** 读版本号时依次尝试的 registry:官方源,再退国内镜像。 */
|
|
143
|
-
const REGISTRIES = ['https://registry.npmjs.org', 'https://registry.npmmirror.com'];
|
|
144
|
-
|
|
145
143
|
/** 读 CHANGELOG 时依次尝试的 CDN(都按版本取包内文件)。 */
|
|
146
144
|
export const DEFAULT_CDN_SOURCES = [
|
|
147
145
|
(version) => `https://cdn.jsdelivr.net/npm/${NPM_NAME}@${version}/CHANGELOG.md`,
|
|
@@ -185,43 +183,28 @@ export function parseChangelogFor(markdown, version) {
|
|
|
185
183
|
}
|
|
186
184
|
|
|
187
185
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* @param {{registryBase?: string, mirrorBase?: string, request?: Function, timeoutMs?: number, onError?: Function}} options
|
|
186
|
+
* 读更新镜像上的 latest 标签,只提示已经同步到下载源的版本。
|
|
187
|
+
* @param {{registryBase?: string, request?: Function, timeoutMs?: number, onError?: Function}} options
|
|
191
188
|
* @returns {Promise<{version: string, url: string}|null>}
|
|
192
189
|
*/
|
|
193
190
|
export async function fetchLatestVersion(options = {}) {
|
|
194
191
|
const request = typeof options.request === 'function' ? options.request : fetch;
|
|
195
192
|
const timeoutMs = Number(options.timeoutMs) || 8000;
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
if (version && !isHiddenPrerelease(version)) {
|
|
211
|
-
return { version, url: `https://www.npmjs.com/package/${NPM_NAME}/v/${version}` };
|
|
212
|
-
}
|
|
213
|
-
reasons.push(`${base}: no usable version`);
|
|
214
|
-
} else {
|
|
215
|
-
reasons.push(`${base}: HTTP ${response ? response.status : 'nothing'}`);
|
|
216
|
-
}
|
|
217
|
-
} catch (error) {
|
|
218
|
-
reasons.push(`${base}: ${String(error && error.message ? error.message : error)}`);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
if (typeof options.onError === 'function') {
|
|
222
|
-
try { options.onError(reasons.join('; ')); } catch (_error) { /* 日志回调不该影响结果 */ }
|
|
193
|
+
const base = String(options.registryBase || UPDATE_REGISTRY).replace(/\/+$/, '');
|
|
194
|
+
try {
|
|
195
|
+
const response = await request(`${base}/${NPM_NAME}/latest`, {
|
|
196
|
+
headers: { accept: 'application/json' },
|
|
197
|
+
redirect: 'error',
|
|
198
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
199
|
+
});
|
|
200
|
+
if (!response?.ok) throw new Error(`HTTP ${response?.status ?? 'no response'}`);
|
|
201
|
+
const version = tagToVersion((await response.json())?.version);
|
|
202
|
+
if (!version || isHiddenPrerelease(version)) throw new Error('no usable version');
|
|
203
|
+
return { version, url: `https://www.npmjs.com/package/${NPM_NAME}/v/${version}` };
|
|
204
|
+
} catch (error) {
|
|
205
|
+
try { options.onError?.(`${base}: ${error?.message || error}`); } catch (_error) { /* 日志回调不该影响结果 */ }
|
|
206
|
+
return null;
|
|
223
207
|
}
|
|
224
|
-
return null;
|
|
225
208
|
}
|
|
226
209
|
|
|
227
210
|
/**
|
package/locale/messages.csv
CHANGED
|
@@ -12,6 +12,9 @@ status.missingConfig,"缺少配置","Not configured","設定が不足してい
|
|
|
12
12
|
action.edit,"编辑","Edit","編集","Editar","Modifier","Bearbeiten","Изменить","Editar"
|
|
13
13
|
action.delete,"删除","Delete","削除","Eliminar","Supprimer","Löschen","Удалить","Excluir"
|
|
14
14
|
action.addProvider,"添加模型提供商","Add provider","モデルプロバイダーを追加","Añadir proveedor","Ajouter un fournisseur","Anbieter hinzufügen","Добавить поставщика","Adicionar provedor"
|
|
15
|
+
delete.title,"删除 {name}?","Delete {name}?","{name} を削除しますか?","¿Eliminar {name}?","Supprimer {name} ?","{name} löschen?","Удалить {name}?","Excluir {name}?"
|
|
16
|
+
delete.description,"删除 {name} 会移除它在这份配置里的提供商信息与模型,并清掉已保存的 API 密钥。","Deleting {name} removes this provider and its models from the configuration, and clears the stored API key.","{name} を削除すると、この設定からプロバイダーとモデルが削除され、保存済みの API キーも消去されます。","Eliminar {name} quita este proveedor y sus modelos de la configuración, y borra la clave de API guardada.","Supprimer {name} retire ce fournisseur et ses modèles de la configuration, et efface la clé d’API enregistrée.","Beim Löschen von {name} werden Anbieter und Modelle aus dieser Konfiguration entfernt und der gespeicherte API-Schlüssel gelöscht.","Удаление {name} уберёт провайдера и модели из конфигурации и сотрёт сохранённый ключ API.","Excluir {name} remove o provedor e os modelos desta configuração e apaga a chave de API salva."
|
|
17
|
+
delete.confirm,"删除 {name}","Delete {name}","{name} を削除","Eliminar {name}","Supprimer {name}","{name} löschen","Удалить {name}","Excluir {name}"
|
|
15
18
|
form.displayName,"显示名称","Display name","表示名","Nombre visible","Nom affiché","Anzeigename","Отображаемое имя","Nome de exibição"
|
|
16
19
|
form.baseUrl,"API 地址","API URL","API URL","URL de la API","URL de l'API","API-URL","URL API","URL da API"
|
|
17
20
|
form.protocol,"API 协议","API protocol","API プロトコル","Protocolo de API","Protocole d'API","API-Protokoll","Протокол API","Protocolo da API"
|
|
@@ -216,22 +219,17 @@ quality.turbo,"极速","Turbo","ターボ","Turbo","Turbo","Turbo","Турбо",
|
|
|
216
219
|
"update.failedBroken","更新安装失败,原版本也没能装回,请在插件管理里重新安装","The update failed and the previous version was not restored — reinstall it from plugin management","更新のインストールに失敗し、元のバージョンにも戻せませんでした。プラグイン管理から再インストールしてください","La actualización falló y no se restauró la versión anterior; reinstálala desde la gestión de complementos","La mise à jour a échoué et la version précédente n'a pas été restaurée ; réinstallez le greffon depuis la gestion des plugins","Das Update ist fehlgeschlagen und die vorherige Version wurde nicht wiederhergestellt – installieren Sie das Plugin über die Plugin-Verwaltung neu","Обновление не удалось, и прежняя версия не восстановлена — переустановите плагин в управлении плагинами","A atualização falhou e a versão anterior não foi restaurada — reinstale pelo gerenciamento de plugins"
|
|
217
220
|
"update.unsupported","当前环境不支持自助更新,请运行 {command}","This environment cannot self-update; run {command}","この環境では自動更新できません。{command} を実行してください","Este entorno no admite la actualización automática; ejecuta {command}","Cet environnement ne permet pas la mise à jour automatique ; exécutez {command}","Diese Umgebung kann sich nicht selbst aktualisieren; führen Sie {command} aus","Эта среда не поддерживает самообновление — выполните {command}","Este ambiente não permite atualização automática; execute {command}"
|
|
218
221
|
"update.localDev","本地开发安装,请自行 git pull","Local development install — run git pull yourself","ローカル開発用のインストールです。git pull を実行してください","Instalación de desarrollo local: ejecuta git pull","Installation de développement local — lancez git pull","Lokale Entwicklungsinstallation – bitte selbst git pull ausführen","Локальная установка для разработки — выполните git pull","Instalação de desenvolvimento local — execute git pull"
|
|
219
|
-
"update.command","dsh plugin add dsh-mo-image@{tag}","dsh plugin add dsh-mo-image@{tag}","dsh plugin add dsh-mo-image@{tag}","dsh plugin add dsh-mo-image@{tag}","dsh plugin add dsh-mo-image@{tag}","dsh plugin add dsh-mo-image@{tag}","dsh plugin add dsh-mo-image@{tag}","dsh plugin add dsh-mo-image@{tag}"
|
|
222
|
+
"update.command","dsh plugin --profile web add dsh-mo-image@{tag} --registry=https://registry.npmmirror.com","dsh plugin --profile web add dsh-mo-image@{tag} --registry=https://registry.npmmirror.com","dsh plugin --profile web add dsh-mo-image@{tag} --registry=https://registry.npmmirror.com","dsh plugin --profile web add dsh-mo-image@{tag} --registry=https://registry.npmmirror.com","dsh plugin --profile web add dsh-mo-image@{tag} --registry=https://registry.npmmirror.com","dsh plugin --profile web add dsh-mo-image@{tag} --registry=https://registry.npmmirror.com","dsh plugin --profile web add dsh-mo-image@{tag} --registry=https://registry.npmmirror.com","dsh plugin --profile web add dsh-mo-image@{tag} --registry=https://registry.npmmirror.com"
|
|
220
223
|
"update.viewRelease","在 npm 查看","View on npm","npm で見る","Ver en npm","Voir sur npm","Auf npm ansehen","Открыть на npm","Ver no npm"
|
|
221
224
|
"update.noNotes","暂无更新说明","This release has no notes.","このリリースには説明がありません。","Esta versión no tiene notas.","Cette version n'a pas de notes.","Diese Version hat keine Hinweise.","В этом выпуске нет примечаний.","Esta versão não tem notas."
|
|
222
225
|
"form.modelMappingParse","解析工作流","Parse workflow","ワークフローを解析","Analizar flujo de trabajo","Analyser le workflow","Workflow analysieren","Разобрать workflow","Analisar fluxo"
|
|
223
226
|
"form.modelMappingParsing","解析中…","Parsing…","解析中…","Analizando…","Analyse…","Analysiere…","Разбор…","Analisando…"
|
|
224
227
|
"form.modelMappingFailed","解析失败","Parsing failed","解析に失敗しました","No se pudo analizar","Analyse impossible","Analyse fehlgeschlagen","Не удалось разобрать","Falha ao analisar"
|
|
225
|
-
"form.modelMappingSkip","不注入","Do not inject","注入しない","No inyectar","Ne pas injecter","Nicht einsetzen","Не внедрять","Não injetar"
|
|
226
228
|
"form.modelMappingFormatApi","API 格式","API format","API 形式","Formato API","Format API","API-Format","Формат API","Formato API"
|
|
227
229
|
"form.modelMappingFormatUi","UI 格式","UI format","UI 形式","Formato UI","Format UI","UI-Format","Формат UI","Formato UI"
|
|
228
230
|
"form.modelMappingSampler","采样器","Sampler","サンプラー","Muestreador","Sampler","Sampler","Сэмплер","Amostrador"
|
|
229
|
-
"form.
|
|
230
|
-
"form.
|
|
231
|
-
"form.modelMappingImage","参考图","Reference image","参照画像","Imagen de referencia","Image de référence","Referenzbild","Референс","Imagem de referência"
|
|
232
|
-
"form.modelMappingColName","参数名","Parameter","パラメータ","Parámetro","Paramètre","Parameter","Параметр","Parâmetro"
|
|
233
|
-
"form.modelMappingColTarget","参数映射","Mapping","マッピング","Mapeo","Correspondance","Zuordnung","Привязка","Mapeamento"
|
|
234
|
-
"form.modelAutoInjectHint","提示词与负面词由工具参数直接写入,不需要在这里配置。","The prompt and negative prompt come straight from the tool call, so there is nothing to configure here.","プロンプトとネガティブプロンプトはツール引数から直接書き込まれるため、ここでの設定は不要です。","El prompt y el prompt negativo llegan de la llamada de la herramienta, así que aquí no hay nada que configurar.","Les prompts positif et négatif viennent de l'appel d'outil : rien à configurer ici.","Prompt und Negativ-Prompt kommen direkt aus dem Werkzeugaufruf, hier ist nichts einzustellen.","Промпт и негативный промпт подставляются из вызова инструмента, здесь настраивать нечего.","O prompt e o prompt negativo vêm da chamada da ferramenta; não há nada para configurar aqui."
|
|
231
|
+
"form.modelMappingAmbiguousImage","检测到多个图像输入。用 {{image}} 标记一张参考图,或用 {{image_1}}、{{image_2}} 连续编号。","Multiple image inputs found. Use {{image}} for one reference or number them with {{image_1}}, {{image_2}}, and so on.","画像入力が複数見つかりました。参照画像が1枚なら {{image}}、複数なら {{image_1}}、{{image_2}} のように指定してください。","Hay varias entradas de imagen. Usa {{image}} para una referencia o numéralas con {{image_1}}, {{image_2}}, etc.","Plusieurs entrées d’image détectées. Utilisez {{image}} pour une référence ou numérotez-les avec {{image_1}}, {{image_2}}, etc.","Mehrere Bildeingänge gefunden. Verwende {{image}} für eine Referenz oder nummeriere sie mit {{image_1}}, {{image_2}} usw.","Найдено несколько входов для изображений. Используйте {{image}} для одного референса или нумеруйте их как {{image_1}}, {{image_2}} и т. д.","Há várias entradas de imagem. Use {{image}} para uma referência ou numere-as com {{image_1}}, {{image_2}} e assim por diante."
|
|
232
|
+
"form.modelAutoInjectHint","提示词自动写入工作流。尺寸和支持的质量档位在模型选择器里调整。","Prompts are inserted automatically. Adjust size and supported quality levels in the model picker.","プロンプトは自動で入力されます。サイズと対応する品質レベルはモデル選択メニューで調整できます。","Los prompts se insertan automáticamente. Ajusta el tamaño y los niveles de calidad admitidos en el selector de modelos.","Les prompts sont insérés automatiquement. Réglez la taille et les niveaux de qualité pris en charge dans le sélecteur de modèles.","Prompts werden automatisch eingefügt. Größe und verfügbare Qualitätsstufen lassen sich in der Modellauswahl einstellen.","Промпты подставляются автоматически. Размер и доступные уровни качества настраиваются в меню выбора модели.","Os prompts são inseridos automaticamente. Ajuste o tamanho e os níveis de qualidade disponíveis no seletor de modelos."
|
|
235
233
|
"param.steps","步数","Steps","ステップ数","Pasos","Étapes","Schritte","Шаги","Passos"
|
|
236
234
|
"param.cfg","提示词强度","CFG scale","プロンプト強度","Intensidad del prompt","Intensité du prompt","Prompt-Stärke","Сила промпта","Intensidade do prompt"
|
|
237
235
|
"param.sampler_name","采样器","Sampler","サンプラー","Muestreador","Échantillonneur","Sampler","Сэмплер","Amostrador"
|
|
@@ -316,7 +314,7 @@ form.paramDescModel,请求里发送的模型名,Model name sent in the request,
|
|
|
316
314
|
form.paramDescN,一次生成的张数,Images per request,1回に生成する枚数,Imágenes por petición,Images par requête,Bilder pro Anfrage,Изображений за запрос,Imagens por requisição
|
|
317
315
|
form.paramNameHintWorkflow,工作流参数的名字只是给对话模型看的键,A workflow parameter name is only the key the chat model sees,ワークフローパラメータの名前は対話モデルが見るキーです,El nombre de un parámetro de flujo es solo la clave que ve el modelo,Le nom d'un paramètre de workflow n'est que la clé vue par le modèle,Der Name eines Workflow-Parameters ist nur der Schlüssel für das Chat-Modell,Имя параметра workflow — только ключ для чат-модели,O nome de um parâmetro de fluxo é só a chave vista pelo modelo
|
|
318
316
|
form.paramNameRequired,参数名不能为空;留空的话请求里没有模型名,这个模型就发不出去,Parameter name cannot be empty; without it the request carries no model name and this model cannot be sent,パラメータ名は必須です。空欄だとリクエストにモデル名が入らず、このモデルは送信できません,El nombre del parámetro no puede estar vacío; sin él la petición no lleva nombre de modelo y este modelo no se puede enviar,Le nom du paramètre ne peut pas être vide ; sans lui la requête ne porte pas de nom de modèle et ce modèle ne peut pas être envoyé,Der Parametername darf nicht leer sein; ohne ihn enthält die Anfrage keinen Modellnamen und dieses Modell kann nicht gesendet werden,Имя параметра не может быть пустым; без него в запросе нет имени модели и эту модель нельзя отправить,O nome do parâmetro não pode ficar vazio; sem ele a requisição não leva nome de modelo e este modelo não pode ser enviado
|
|
319
|
-
form.paramWorkflowTableHint
|
|
317
|
+
form.paramWorkflowTableHint,开启「暴露」后,对话模型可以调整对应的工作流参数。,Expose a workflow parameter to let the chat model adjust it.,ワークフローのパラメータを公開するとチャットモデルが調整できます。,Expón un parámetro del flujo para que el modelo de chat pueda ajustarlo.,Exposez un paramètre du workflow pour que le modèle de chat puisse l’ajuster.,Gib einen Workflow-Parameter frei damit das Chatmodell ihn anpassen kann.,Откройте параметр рабочего процесса для изменения моделью чата.,Exponha um parâmetro do fluxo para permitir que o modelo de chat o ajuste.
|
|
320
318
|
form.paramsEmptyWorkflow,"还没解析出参数。先粘贴工作流,再点「解析工作流」。","No parameters parsed yet. Paste a workflow, then click “Parse workflow”.","まだパラメータを解析していません。先にワークフローを貼り付け、「ワークフローを解析」をクリックしてください。","Aún no hay parámetros analizados. Pega un flujo de trabajo y luego pulsa «Analizar flujo de trabajo».","Aucun paramètre analysé pour l’instant. Collez un workflow, puis cliquez sur « Analyser le workflow ».","Noch keine Parameter analysiert. Fügen Sie zuerst einen Workflow ein und klicken Sie dann auf „Workflow analysieren“.","Параметры ещё не разобраны. Вставьте workflow и нажмите «Разобрать workflow».","Nenhum parâmetro analisado ainda. Cole um fluxo de trabalho e clique em «Analisar fluxo»."
|
|
321
319
|
form.paramsEmpty,"这个模型还没有可调参数,点「添加参数」自己加。","This model has no tunable parameters yet. Click “Add parameter” to add one.","このモデルにはまだ調整できるパラメータがありません。「パラメータを追加」から追加してください。","Este modelo aún no tiene parámetros ajustables. Pulsa «Añadir parámetro» para crear uno.","Ce modèle n’a pas encore de paramètres réglables. Cliquez sur « Ajouter un paramètre » pour en créer un.","Dieses Modell hat noch keine einstellbaren Parameter. Klicken Sie auf „Parameter hinzufügen“, um einen anzulegen.","У этой модели пока нет настраиваемых параметров. Нажмите «Добавить параметр», чтобы создать.","Este modelo ainda não tem parâmetros ajustáveis. Clique em «Adicionar parâmetro» para criar um."
|
|
322
320
|
form.a1111ParamRowsHint,默认值会随请求发送;清空某一行的默认值就沿用 WebUI 里的设置,Defaults are sent with the request; clear a default to fall back to the WebUI setting,既定値はリクエストと一緒に送信されます。空にすると WebUI の設定に従います,Los valores por defecto se envían con la petición; vacía uno para usar la configuración del WebUI,Les valeurs par défaut sont envoyées avec la requête ; videz-en une pour suivre le réglage du WebUI,Standardwerte werden mitgesendet; ein geleerter Wert folgt der WebUI-Einstellung,Значения по умолчанию отправляются с запросом; очистите — возьмётся настройка WebUI,Os padrões são enviados com a requisição; limpe um valor para seguir a configuração do WebUI
|
|
@@ -386,6 +384,7 @@ protocol.ideogram,"Ideogram","Ideogram","Ideogram","Ideogram","Ideogram","Ideogr
|
|
|
386
384
|
protocol.stability,"Stability AI","Stability AI","Stability AI","Stability AI","Stability AI","Stability AI","Stability AI","Stability AI"
|
|
387
385
|
protocol.dashscope-qwen-image,"百炼 Qwen-Image","Alibaba Qwen-Image","Alibaba Qwen-Image","Alibaba Qwen-Image","Alibaba Qwen-Image","Alibaba Qwen-Image","Alibaba Qwen-Image","Alibaba Qwen-Image"
|
|
388
386
|
protocol.dashscope-wanx,"百炼 通义万相","Alibaba Wanx","Alibaba Wanx","Alibaba Wanx","Alibaba Wanx","Alibaba Wanx","Alibaba Wanx","Alibaba Wanx"
|
|
387
|
+
protocol.tokenhub-hy-image,"腾讯云 混元生图","TokenHub Hy-Image","TokenHub Hy-Image","TokenHub Hy-Image","TokenHub Hy-Image","TokenHub Hy-Image","TokenHub Hy-Image","TokenHub Hy-Image"
|
|
389
388
|
protocol.a1111,"AUTOMATIC1111","AUTOMATIC1111","AUTOMATIC1111","AUTOMATIC1111","AUTOMATIC1111","AUTOMATIC1111","AUTOMATIC1111","AUTOMATIC1111"
|
|
390
389
|
protocol.comfyui,"ComfyUI","ComfyUI","ComfyUI","ComfyUI","ComfyUI","ComfyUI","ComfyUI","ComfyUI"
|
|
391
390
|
protocol.swarmui,"SwarmUI","SwarmUI","SwarmUI","SwarmUI","SwarmUI","SwarmUI","SwarmUI","SwarmUI"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mo-image",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "DSH plugin: generate and edit images with model-aware prompt guidance over an OpenAI-compatible image model",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"icon.png",
|
|
25
25
|
"cordis.patch.yml",
|
|
26
26
|
"CHANGELOG.md",
|
|
27
|
-
"THIRD-PARTY-NOTICES.md",
|
|
28
27
|
"README.md"
|
|
29
28
|
],
|
|
30
29
|
"engines": {
|
|
@@ -11,12 +11,13 @@ whenToUse: 修改或融合参考图时,需要当前上下文中没有的编辑
|
|
|
11
11
|
- 只负责把编辑提示词和参考图交给生图模型,不替用户判断图片好坏。
|
|
12
12
|
- 本会话首次生图或改图前调用 `mo_image_settings`。之后直接调用 `mo_image_edit`,由工具通过 `needsSettings` 返回变更或校准配置。使用返回的完整设置,或在 `baseRevision` 上应用 `changes`、清除 `removed`,然后发起新调用。应用增量时找不到基线才用 `refresh:true` 读取完整配置。
|
|
13
13
|
- 自动模型使用 `editModelIndexes` 从 `models` 选择,也可以省略 `model` 使用首个可改图的候选。需要具体尺寸、质量或参数时,传候选的模型 ID 查询。
|
|
14
|
+
- ComfyUI 若返回 `referenceImages`,按其中的编号、用途和数量传 `images`。自动模式下,若所选候选位于 `referenceModelIndexes`,在缺少该候选详情或 `referenceRevision` 改变时查询一次。图片用途有歧义时向用户确认。
|
|
14
15
|
- `model` 不用传:非 Auto 时用选择器里的模型,传别的值会被拒绝;Auto 必须从当前列表里选一个。
|
|
15
16
|
- 图片返回即交付:最终回复只输出工具给的图片行;不评价画质、不描述画面。除非用户明确要求看图,否则不要打开或读取图片。
|
|
16
17
|
- 只用选择器里的提供商和模型:不要自行切换,也不要用本地生图、建模/Blender、脚本绘图替代。
|
|
17
18
|
- 收到「生图配置不匹配(未提交)」时,用 `mo_image_settings({"refresh":true})` 重读完整配置,纠正参数后只重试一次。仍失败或遇到其他错误时原样报错。沿用用户选定的提供商和模型。
|
|
18
19
|
|
|
19
|
-
优化开启时,在提示词里**说清改什么、保留什么**。复用上下文已有的写法和合适的成稿。优化关闭时,prompt
|
|
20
|
+
优化开启时,在提示词里**说清改什么、保留什么**。复用上下文已有的写法和合适的成稿。优化关闭时,prompt 只写用户原话或做最低限度整理;用户明确要求优化时才改写。工作流有入口编号时按编号传参考图,其余情况沿用用户指定的顺序。
|
|
20
21
|
|
|
21
22
|
## 一、编辑公式
|
|
22
23
|
|
package/THIRD-PARTY-NOTICES.md
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# Third-party notices
|
|
2
|
-
|
|
3
|
-
## dsh-codex-model-effort-selector
|
|
4
|
-
|
|
5
|
-
The Codex-skin geometry (272×104 popover, 30px knob, rail padding), the
|
|
6
|
-
per-level colour ramps (light/dark), the deterministic sparkle/bloom
|
|
7
|
-
distribution, the ⚡ Fast toggle/`fast-mode` class contract, the peak
|
|
8
|
-
gradient/sparkle treatment and several interaction details in `lib/client.js`
|
|
9
|
-
are adapted from
|
|
10
|
-
[dsh-codex-model-effort-selector](https://github.com/ABING1111/dsh-codex-model-effort-selector).
|
|
11
|
-
|
|
12
|
-
MIT License
|
|
13
|
-
|
|
14
|
-
Copyright (c) 2026 dsh-codex-model-effort-selector contributors
|
|
15
|
-
|
|
16
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
18
|
-
in the Software without restriction, including without limitation the rights
|
|
19
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
21
|
-
furnished to do so, subject to the following conditions:
|
|
22
|
-
|
|
23
|
-
The above copyright notice and this permission notice shall be included in all
|
|
24
|
-
copies or substantial portions of the Software.
|
|
25
|
-
|
|
26
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
|
-
SOFTWARE.
|