dsh-mo-image 0.5.0 → 0.5.1
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 +5 -0
- package/README.md +20 -3
- package/lib/client.js +29 -9
- package/lib/index.js +91 -49
- package/lib/prompt-profiles.js +56 -4
- package/lib/update-service.js +40 -17
- package/locale/messages.csv +3 -1
- package/package.json +1 -1
- package/skills/mo-image-editing/SKILL.md +5 -4
- package/skills/mo-image-generation/SKILL.md +6 -5
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
- DSH >= 0.2.1-rc.2
|
|
22
22
|
- Node.js / pnpm(DSH 已自带)
|
|
23
23
|
|
|
24
|
+
从 npm 安装(推荐):
|
|
25
|
+
|
|
26
|
+
~~~bash
|
|
27
|
+
dsh plugin --profile desktop add dsh-mo-image
|
|
28
|
+
~~~
|
|
29
|
+
|
|
24
30
|
从 GitHub 安装:
|
|
25
31
|
|
|
26
32
|
~~~bash
|
|
@@ -49,7 +55,7 @@ DSH 每次启动会查一次 npm 上的最新版本(`registry.npmjs.org`,不
|
|
|
49
55
|
更新说明来自包里的 `CHANGELOG.md`(按版本从 jsDelivr / unpkg / npmmirror 读取);那个版本没写说明时,对话框显示「暂无更新说明」。
|
|
50
56
|
|
|
51
57
|
- 用 `link:` 方式安装的开发环境不会自动改文件,点更新只会提示你自己 `git pull`。
|
|
52
|
-
-
|
|
58
|
+
- 检测和安装都走 npm:点更新时按 `dsh-mo-image@x.y.z` 的版本规格安装,不依赖 GitHub。从 npm 安装的走 DSH 原生的 `updateBundle`(先卸旧版再装新版,装失败会自动装回旧版);早期用 `github:` 装的会被换成 npm 版——这条「先卸载再装」的路径没有 DSH 的自动回滚,所以 npm 安装失败时会按原来的规格装回去,并明确提示「更新安装失败,已装回原来的版本」;万一连装回也失败,会提示你去插件管理里重装,不会静默失败。
|
|
53
59
|
- 没有桌面版的插件管理器时,手动更新:
|
|
54
60
|
|
|
55
61
|
~~~bash
|
|
@@ -123,12 +129,23 @@ npm run release -- minor --dry-run # 只看会做什么
|
|
|
123
129
|
|
|
124
130
|
模型会在需要时调用:
|
|
125
131
|
|
|
132
|
+
- mo_image_settings:生图/改图前读当前配置(模型、提示词优化开关、该模型的写法)
|
|
126
133
|
- mo_image_generate:文生图 / 重做
|
|
127
134
|
- mo_image_edit:参考图编辑 / 局部修改
|
|
128
135
|
|
|
129
|
-
工具接收 prompt、negative_prompt、images
|
|
136
|
+
工具接收 prompt、negative_prompt、images;`model` 可选,尺寸和质量仍由生图选择器控制(工具不接收 `size` / `quality`)。
|
|
137
|
+
|
|
138
|
+
**两步生图**:每次生图/改图前先调用 `mo_image_settings`,它返回一个很小的 JSON——当前提供商和模型的唯一 id、提示词优化开关、一句该模型的写法提示(Auto 模式下再加可选模型 id):
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{"provider":"comfyui","model":"flux-2-klein-4b.safetensors","promptOptimization":true,"hint":"自然语言散文,主体+动作前置,30–80 词;英文优先;无 negative prompt;完整写法没读过时先加载对应 skill,读过就不用再加载"}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
提示词优化开启时,`hint` 末尾会带这半句:完整写法(skill 里的模板与示例)只在当前模型的还没读过时才要加载,读过就不用重复加载;优化关闭时没有这半句,因为那时直接照用户原话写。
|
|
145
|
+
|
|
146
|
+
模型每次写提示词前都得重读一遍。同一个会话里没有先读配置就调用生图工具会被直接拒绝,不会发请求。一次读取在当前回合内有效;用户在设置里换了模型、切了提示词优化开关或改了质量后,上一次读取自动作废,必须重读。
|
|
130
147
|
|
|
131
|
-
|
|
148
|
+
**`model` 是可选的核对项**:不传就用用户选中的那一项(提供商 + 模型 id 一起核对,不同提供商的同名模型不算同一个),传了不一致的值直接拒绝;Auto 模式下必须从当前提供商的模型列表里挑一个。传了 `provider` 也会核对,不一致同样拒绝——工具永远不会替用户切换提供商或模型。
|
|
132
149
|
|
|
133
150
|
**Auto 行**:模型选择器第一行是“自动”(英文界面为 `Auto`)。只有选中它,对话模型才享有模型选择权;选中后系统提示词会列出可选模型。没有配置任何模型时(所有提供商的模型目录都为空)不显示自动行,直接显示“还没有模型,去设置 → 生图模型添加”。
|
|
134
151
|
|
package/lib/client.js
CHANGED
|
@@ -3242,9 +3242,11 @@ window.__ModuleLoader__.load({
|
|
|
3242
3242
|
"update.doneRestart": "更新已完成,重启 DSH 后生效",
|
|
3243
3243
|
"update.done": "已更新到 {version}",
|
|
3244
3244
|
"update.failed": "更新未完成,请重试",
|
|
3245
|
+
"update.failedRestored": "更新安装失败,已装回原来的版本",
|
|
3246
|
+
"update.failedBroken": "更新安装失败,原版本也没能装回,请在插件管理里重新安装",
|
|
3245
3247
|
"update.unsupported": "当前环境不支持自助更新,请运行 {command}",
|
|
3246
3248
|
"update.localDev": "本地开发安装,请自行 git pull",
|
|
3247
|
-
"update.command": "dsh plugin add
|
|
3249
|
+
"update.command": "dsh plugin add dsh-mo-image@{tag}",
|
|
3248
3250
|
"update.viewRelease": "在 npm 查看",
|
|
3249
3251
|
"update.noNotes": "暂无更新说明",
|
|
3250
3252
|
},
|
|
@@ -3421,9 +3423,11 @@ window.__ModuleLoader__.load({
|
|
|
3421
3423
|
"update.doneRestart": "Update installed — restart DSH to apply",
|
|
3422
3424
|
"update.done": "Updated to {version}",
|
|
3423
3425
|
"update.failed": "Update did not finish — try again",
|
|
3426
|
+
"update.failedRestored": "The update failed — the previous version was restored",
|
|
3427
|
+
"update.failedBroken": "The update failed and the previous version was not restored — reinstall it from plugin management",
|
|
3424
3428
|
"update.unsupported": "This environment cannot self-update; run {command}",
|
|
3425
3429
|
"update.localDev": "Local development install — run git pull yourself",
|
|
3426
|
-
"update.command": "dsh plugin add
|
|
3430
|
+
"update.command": "dsh plugin add dsh-mo-image@{tag}",
|
|
3427
3431
|
"update.viewRelease": "View on npm",
|
|
3428
3432
|
"update.noNotes": "This release has no notes.",
|
|
3429
3433
|
},
|
|
@@ -3600,9 +3604,11 @@ window.__ModuleLoader__.load({
|
|
|
3600
3604
|
"update.doneRestart": "更新が完了しました。DSH を再起動すると有効になります",
|
|
3601
3605
|
"update.done": "{version} に更新しました",
|
|
3602
3606
|
"update.failed": "更新が完了しませんでした。もう一度お試しください",
|
|
3607
|
+
"update.failedRestored": "更新のインストールに失敗しました。元のバージョンに戻しました",
|
|
3608
|
+
"update.failedBroken": "更新のインストールに失敗し、元のバージョンにも戻せませんでした。プラグイン管理から再インストールしてください",
|
|
3603
3609
|
"update.unsupported": "この環境では自動更新できません。{command} を実行してください",
|
|
3604
3610
|
"update.localDev": "ローカル開発用のインストールです。git pull を実行してください",
|
|
3605
|
-
"update.command": "dsh plugin add
|
|
3611
|
+
"update.command": "dsh plugin add dsh-mo-image@{tag}",
|
|
3606
3612
|
"update.viewRelease": "npm で見る",
|
|
3607
3613
|
"update.noNotes": "このリリースには説明がありません。",
|
|
3608
3614
|
},
|
|
@@ -3779,9 +3785,11 @@ window.__ModuleLoader__.load({
|
|
|
3779
3785
|
"update.doneRestart": "Actualización instalada. Reinicia DSH para aplicarla",
|
|
3780
3786
|
"update.done": "Actualizado a {version}",
|
|
3781
3787
|
"update.failed": "La actualización no terminó. Inténtalo de nuevo",
|
|
3788
|
+
"update.failedRestored": "La actualización falló; se restauró la versión anterior",
|
|
3789
|
+
"update.failedBroken": "La actualización falló y no se restauró la versión anterior; reinstálala desde la gestión de complementos",
|
|
3782
3790
|
"update.unsupported": "Este entorno no admite la actualización automática; ejecuta {command}",
|
|
3783
3791
|
"update.localDev": "Instalación de desarrollo local: ejecuta git pull",
|
|
3784
|
-
"update.command": "dsh plugin add
|
|
3792
|
+
"update.command": "dsh plugin add dsh-mo-image@{tag}",
|
|
3785
3793
|
"update.viewRelease": "Ver en npm",
|
|
3786
3794
|
"update.noNotes": "Esta versión no tiene notas.",
|
|
3787
3795
|
},
|
|
@@ -3958,9 +3966,11 @@ window.__ModuleLoader__.load({
|
|
|
3958
3966
|
"update.doneRestart": "Mise à jour installée — redémarrez DSH pour l'appliquer",
|
|
3959
3967
|
"update.done": "Mis à jour vers {version}",
|
|
3960
3968
|
"update.failed": "La mise à jour ne s'est pas terminée — réessayez",
|
|
3969
|
+
"update.failedRestored": "La mise à jour a échoué ; la version précédente a été restaurée",
|
|
3970
|
+
"update.failedBroken": "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",
|
|
3961
3971
|
"update.unsupported": "Cet environnement ne permet pas la mise à jour automatique ; exécutez {command}",
|
|
3962
3972
|
"update.localDev": "Installation de développement local — lancez git pull",
|
|
3963
|
-
"update.command": "dsh plugin add
|
|
3973
|
+
"update.command": "dsh plugin add dsh-mo-image@{tag}",
|
|
3964
3974
|
"update.viewRelease": "Voir sur npm",
|
|
3965
3975
|
"update.noNotes": "Cette version n'a pas de notes.",
|
|
3966
3976
|
},
|
|
@@ -4137,9 +4147,11 @@ window.__ModuleLoader__.load({
|
|
|
4137
4147
|
"update.doneRestart": "Update installiert – DSH neu starten, um es anzuwenden",
|
|
4138
4148
|
"update.done": "Auf {version} aktualisiert",
|
|
4139
4149
|
"update.failed": "Das Update wurde nicht abgeschlossen – bitte erneut versuchen",
|
|
4150
|
+
"update.failedRestored": "Das Update ist fehlgeschlagen – die vorherige Version wurde wiederhergestellt",
|
|
4151
|
+
"update.failedBroken": "Das Update ist fehlgeschlagen und die vorherige Version wurde nicht wiederhergestellt – installieren Sie das Plugin über die Plugin-Verwaltung neu",
|
|
4140
4152
|
"update.unsupported": "Diese Umgebung kann sich nicht selbst aktualisieren; führen Sie {command} aus",
|
|
4141
4153
|
"update.localDev": "Lokale Entwicklungsinstallation – bitte selbst git pull ausführen",
|
|
4142
|
-
"update.command": "dsh plugin add
|
|
4154
|
+
"update.command": "dsh plugin add dsh-mo-image@{tag}",
|
|
4143
4155
|
"update.viewRelease": "Auf npm ansehen",
|
|
4144
4156
|
"update.noNotes": "Diese Version hat keine Hinweise.",
|
|
4145
4157
|
},
|
|
@@ -4316,9 +4328,11 @@ window.__ModuleLoader__.load({
|
|
|
4316
4328
|
"update.doneRestart": "Обновление установлено — перезапустите DSH",
|
|
4317
4329
|
"update.done": "Обновлено до {version}",
|
|
4318
4330
|
"update.failed": "Обновление не завершено — повторите попытку",
|
|
4331
|
+
"update.failedRestored": "Обновление не удалось — прежняя версия восстановлена",
|
|
4332
|
+
"update.failedBroken": "Обновление не удалось, и прежняя версия не восстановлена — переустановите плагин в управлении плагинами",
|
|
4319
4333
|
"update.unsupported": "Эта среда не поддерживает самообновление — выполните {command}",
|
|
4320
4334
|
"update.localDev": "Локальная установка для разработки — выполните git pull",
|
|
4321
|
-
"update.command": "dsh plugin add
|
|
4335
|
+
"update.command": "dsh plugin add dsh-mo-image@{tag}",
|
|
4322
4336
|
"update.viewRelease": "Открыть на npm",
|
|
4323
4337
|
"update.noNotes": "В этом выпуске нет примечаний.",
|
|
4324
4338
|
},
|
|
@@ -4495,9 +4509,11 @@ window.__ModuleLoader__.load({
|
|
|
4495
4509
|
"update.doneRestart": "Atualização instalada — reinicie o DSH para aplicar",
|
|
4496
4510
|
"update.done": "Atualizado para {version}",
|
|
4497
4511
|
"update.failed": "A atualização não terminou — tente novamente",
|
|
4512
|
+
"update.failedRestored": "A atualização falhou — a versão anterior foi restaurada",
|
|
4513
|
+
"update.failedBroken": "A atualização falhou e a versão anterior não foi restaurada — reinstale pelo gerenciamento de plugins",
|
|
4498
4514
|
"update.unsupported": "Este ambiente não permite atualização automática; execute {command}",
|
|
4499
4515
|
"update.localDev": "Instalação de desenvolvimento local — execute git pull",
|
|
4500
|
-
"update.command": "dsh plugin add
|
|
4516
|
+
"update.command": "dsh plugin add dsh-mo-image@{tag}",
|
|
4501
4517
|
"update.viewRelease": "Ver no npm",
|
|
4502
4518
|
"update.noNotes": "Esta versão não tem notas.",
|
|
4503
4519
|
},
|
|
@@ -4604,7 +4620,11 @@ window.__ModuleLoader__.load({
|
|
|
4604
4620
|
? translate('update.done', { version: status.latest })
|
|
4605
4621
|
: translate('update.doneRestart');
|
|
4606
4622
|
}
|
|
4607
|
-
if (state === 'failed')
|
|
4623
|
+
if (state === 'failed') {
|
|
4624
|
+
if (status.error === 'update.failedRestored') return translate('update.failedRestored');
|
|
4625
|
+
if (status.error === 'update.failedBroken') return translate('update.failedBroken');
|
|
4626
|
+
return translate('update.failed');
|
|
4627
|
+
}
|
|
4608
4628
|
if (state === 'updating') return translate('update.starting');
|
|
4609
4629
|
return null;
|
|
4610
4630
|
}
|
package/lib/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
listProviderModelEntries, adapterManifest, localPresetManifest, providerPresetManifest, MAX_IMAGE_BYTES,
|
|
16
16
|
adapterSupportsKind
|
|
17
17
|
} from './adapters.js';
|
|
18
|
-
import { promptSectionText, resolvePromptProfile } from './prompt-profiles.js';
|
|
18
|
+
import { promptSectionText, resolvePromptProfile, settingsPayload } from './prompt-profiles.js';
|
|
19
19
|
import { request, setNetworkLogger } from './net.js';
|
|
20
20
|
import { configWriteReason } from './config-guard.js';
|
|
21
21
|
import { localizedError, errorBody } from './localized-error.js';
|
|
@@ -350,38 +350,6 @@ async function publicConfig(store, config) {
|
|
|
350
350
|
return Object.assign({}, config, { providers: providers });
|
|
351
351
|
}
|
|
352
352
|
/** 选择器用的模型能力表:目前先下发每个模型可用的质量档位。 */
|
|
353
|
-
/** 本地部署器:没有云端鉴权,走本机或局域网接口。 */
|
|
354
|
-
const LOCAL_ADAPTERS = new Set(['a1111', 'comfyui', 'swarmui', 'localai']);
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* 给模型看的模型清单:只有 id、显示名、部署方式,绝不带 key 或凭据引用。
|
|
358
|
-
* 模型没有别的途径读配置(配置文件被守卫拦着),所以这里要够用。
|
|
359
|
-
*/
|
|
360
|
-
export function modelListSnapshot(config) {
|
|
361
|
-
const providers = Array.isArray(config && config.providers) ? config.providers : [];
|
|
362
|
-
const activeId = String((config && config.active && config.active.providerId) || '');
|
|
363
|
-
const activeModel = String((config && config.active && config.active.model) || '');
|
|
364
|
-
const activeProvider = providers.find((item) => item.id === activeId) || null;
|
|
365
|
-
const nameOf = (provider, model) => String((provider && provider.names && provider.names[model]) || '');
|
|
366
|
-
return {
|
|
367
|
-
auto: activeModel === 'auto',
|
|
368
|
-
active: {
|
|
369
|
-
providerId: activeProvider ? activeProvider.id : '',
|
|
370
|
-
providerName: activeProvider ? activeProvider.name : '',
|
|
371
|
-
model: activeModel,
|
|
372
|
-
modelName: activeModel === 'auto' ? '' : nameOf(activeProvider, activeModel)
|
|
373
|
-
},
|
|
374
|
-
providers: providers.map((provider) => ({
|
|
375
|
-
id: provider.id,
|
|
376
|
-
name: provider.name,
|
|
377
|
-
adapter: provider.adapter || '',
|
|
378
|
-
local: !!provider.optionalKey || LOCAL_ADAPTERS.has(String(provider.adapter || '')),
|
|
379
|
-
active: !!activeProvider && activeProvider.id === provider.id,
|
|
380
|
-
models: (provider.models || []).map((model) => ({ id: model, name: nameOf(provider, model) }))
|
|
381
|
-
}))
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
|
|
385
353
|
function capabilityManifest(config) {
|
|
386
354
|
return (config.providers || []).map((provider) => ({
|
|
387
355
|
providerId: provider.id,
|
|
@@ -582,26 +550,28 @@ function pickProvider(config, purpose, args) {
|
|
|
582
550
|
if (!provider) throw new Error('当前选中的生图提供商不存在,请到设置 → 生图模型重新选择。');
|
|
583
551
|
// 严格只用用户选中的模型:不做「编辑时自动换 sunburst」这类回退,
|
|
584
552
|
// 模型不支持对应能力时由 callImageApi 明确报「不支持」,而不是偷偷换一个。
|
|
585
|
-
// 唯一例外是用户把选择器设为 Auto
|
|
553
|
+
// 唯一例外是用户把选择器设为 Auto:此时由工具传进来的 model 决定,且必须在本提供商列表内。
|
|
586
554
|
const activeModel = String(active.model || '').trim();
|
|
587
555
|
if (!activeModel) throw new Error('还没有选择当前生图模型。请先到 DSH 设置 → 生图模型 选择当前模型。');
|
|
588
556
|
const requestedProvider = String((args && args.provider) || '').trim();
|
|
589
557
|
const requestedModel = String((args && args.model) || '').trim();
|
|
590
|
-
//
|
|
558
|
+
// 模型由用户在设置里选定,工具参数只是可选的一致性核对。不让模型复述环境状态:
|
|
559
|
+
// 它会把对话历史里的旧 id 再抄一遍,用户中途切换模型后必定白失败一轮。
|
|
560
|
+
// 传了不一致的值仍然拒绝,防止对话模型自己换提供商/模型。
|
|
591
561
|
if (requestedProvider && requestedProvider !== provider.id && requestedProvider !== provider.name) {
|
|
592
562
|
throw new Error('提供商由用户在设置里固定(当前:' + (provider.name || provider.id) + '),请求的是 ' + requestedProvider + '。要换提供商请让用户在设置里切换。');
|
|
593
563
|
}
|
|
594
|
-
if (!requestedModel) {
|
|
595
|
-
throw new Error('调用生图工具时必须传 model:当前选中的是 ' + (activeModel === 'auto' ? 'Auto(可从列表选择)' : activeModel) + '。');
|
|
596
|
-
}
|
|
597
564
|
let model;
|
|
598
565
|
if (activeModel === 'auto') {
|
|
566
|
+
if (!requestedModel) {
|
|
567
|
+
throw new Error('Auto 模式下要由你选一个模型:' + ((provider.models || []).join(' / ') || '(列表为空,请让用户先在设置里添加模型)') + ',通过 model 传入。');
|
|
568
|
+
}
|
|
599
569
|
if (!(provider.models || []).includes(requestedModel)) {
|
|
600
570
|
throw new Error('Auto 模式只能选当前提供商列表里的模型:' + requestedModel + '。可选:' + ((provider.models || []).join(' / ') || '(列表为空)'));
|
|
601
571
|
}
|
|
602
572
|
model = requestedModel;
|
|
603
573
|
} else {
|
|
604
|
-
if (requestedModel !== activeModel) {
|
|
574
|
+
if (requestedModel && requestedModel !== activeModel) {
|
|
605
575
|
throw new Error('当前选中的模型是 ' + activeModel + '(提供商 ' + (provider.name || provider.id) + '),请求的是 ' + requestedModel + '。模型只能由用户在设置里切换。');
|
|
606
576
|
}
|
|
607
577
|
model = activeModel;
|
|
@@ -1408,32 +1378,102 @@ export function apply(ctx, options = {}) {
|
|
|
1408
1378
|
},
|
|
1409
1379
|
render: renderImage
|
|
1410
1380
|
};
|
|
1381
|
+
// DSH 的工具契约要求每个工具声明 output { schema, render? };settings
|
|
1382
|
+
// 返回值就是给模型看的全部内容:一个最小 JSON(提供商/模型唯一 id + 优化开关 + 一句写法提示)。
|
|
1383
|
+
const modelsOutput = {
|
|
1384
|
+
schema: {
|
|
1385
|
+
type: 'object', additionalProperties: false,
|
|
1386
|
+
required: ['provider', 'model', 'promptOptimization', 'hint'],
|
|
1387
|
+
properties: {
|
|
1388
|
+
provider: { type: 'string' },
|
|
1389
|
+
model: { type: 'string' },
|
|
1390
|
+
promptOptimization: { type: 'boolean' },
|
|
1391
|
+
hint: { type: 'string' },
|
|
1392
|
+
models: { type: 'array', items: { type: 'string' } }
|
|
1393
|
+
}
|
|
1394
|
+
},
|
|
1395
|
+
render: (_args, value) => [{ type: 'text', text: JSON.stringify(value) }]
|
|
1396
|
+
};
|
|
1411
1397
|
|
|
1398
|
+
// 生图前必须先读配置。只靠系统提示词时,多轮之后模型会按上一条提示词的习惯继续写,
|
|
1399
|
+
// 换了模型、关了提示词优化都不看;把当前配置放进工具结果,能让它每次写之前重读一遍。
|
|
1400
|
+
// 一次读取在当前回合内有效,配置一变(换模型、切优化开关)就作废。
|
|
1401
|
+
const marks = new WeakMap();
|
|
1402
|
+
const signatureOf = (state) => {
|
|
1403
|
+
if (!state) return '';
|
|
1404
|
+
const defaults = state.defaults || {};
|
|
1405
|
+
return [
|
|
1406
|
+
(state.provider && state.provider.id) || '', state.model,
|
|
1407
|
+
state.promptOptimization === false ? 'off' : 'on',
|
|
1408
|
+
defaults.quality || '', defaults.width || '', defaults.height || ''
|
|
1409
|
+
].join('|');
|
|
1410
|
+
};
|
|
1411
|
+
const sessionOf = (exec) => (exec && exec.agent && exec.agent.session) || null;
|
|
1412
|
+
const currentTurn = (session) => {
|
|
1413
|
+
try {
|
|
1414
|
+
const projections = ctx.get && ctx.get('sessionProjections');
|
|
1415
|
+
if (!projections || typeof projections.stateOf !== 'function') return null;
|
|
1416
|
+
const boundary = projections.stateOf(session, 'turnBoundary');
|
|
1417
|
+
const seq = boundary && boundary.openTurnStartSeq;
|
|
1418
|
+
return typeof seq === 'number' ? seq : null;
|
|
1419
|
+
} catch (error) { logHost('turn lookup error: ' + String(error && error.message ? error.message : error)); return null; }
|
|
1420
|
+
};
|
|
1421
|
+
const rememberSettings = (exec) => {
|
|
1422
|
+
const session = sessionOf(exec);
|
|
1423
|
+
if (!session) return;
|
|
1424
|
+
marks.set(session, { signature: signatureOf(activeImageState(store)), turn: currentTurn(session) });
|
|
1425
|
+
};
|
|
1426
|
+
const requireSettings = (exec) => {
|
|
1427
|
+
const session = sessionOf(exec);
|
|
1428
|
+
if (!session) return; // 没有会话上下文(脚本调用)时无从比对,不拦。
|
|
1429
|
+
const mark = marks.get(session);
|
|
1430
|
+
const turn = currentTurn(session);
|
|
1431
|
+
const fresh = !!mark
|
|
1432
|
+
&& mark.signature === signatureOf(activeImageState(store))
|
|
1433
|
+
&& (turn === null || mark.turn === turn);
|
|
1434
|
+
if (!fresh) {
|
|
1435
|
+
throw new Error('生成前先读当前配置:调用 mo_image_settings,按它返回的模型写法和提示词优化状态写提示词,再调用本工具。');
|
|
1436
|
+
}
|
|
1437
|
+
};
|
|
1438
|
+
// 拿不到回合号时退回一次一读:生成成功后作废这次读取,失败不消耗。
|
|
1439
|
+
const consumeSettings = (exec) => {
|
|
1440
|
+
const session = sessionOf(exec);
|
|
1441
|
+
if (session && currentTurn(session) === null) marks.delete(session);
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1444
|
+
// 每个工具单独兜底:一个工具的契约不满足时,不会连带其它工具一起注册失败。
|
|
1412
1445
|
try {
|
|
1413
1446
|
ctx.tools.register({
|
|
1414
|
-
name: '
|
|
1415
|
-
description: '
|
|
1447
|
+
name: 'mo_image_settings',
|
|
1448
|
+
description: 'Read the current image settings before every generation or edit: the picked provider and model, whether prompt optimization is on, and a one-line hint for how to write the prompt for that model. Calling mo_image_generate or mo_image_edit without reading this first in the current turn is rejected, so read it again after the user switches models or toggles a setting.',
|
|
1416
1449
|
parameters: { type: 'object', additionalProperties: false, properties: {} },
|
|
1450
|
+
output: modelsOutput,
|
|
1417
1451
|
timeoutMs: 15000,
|
|
1418
|
-
async execute() {
|
|
1419
|
-
|
|
1452
|
+
async execute(_args, exec) {
|
|
1453
|
+
rememberSettings(exec);
|
|
1454
|
+
return settingsPayload(activeImageState(store));
|
|
1420
1455
|
}
|
|
1421
1456
|
});
|
|
1457
|
+
} catch (error) { logHost('settings tool register error: ' + String(error)); }
|
|
1458
|
+
|
|
1459
|
+
try {
|
|
1422
1460
|
ctx.tools.register({
|
|
1423
1461
|
name: 'mo_image_generate',
|
|
1424
|
-
description: 'Generate a new image with the active image model.
|
|
1462
|
+
description: 'Generate a new image with the active image model. Call mo_image_settings first in this turn: it returns the current model, the prompt-optimization state and the writing rules for that model, and this tool rejects a call that did not read it. Then follow what it returned: when optimization is On, write the final prompt in the active model\'s dialect; when Off, pass the user\'s original wording unchanged. Model, size, and quality come from the picker, so leave the model argument out; only in Auto mode must you pass one id from the active provider list. Load the mo-image-generation skill only when you have not already read this model\'s writing rules in this conversation; when optimization is Off, use only its invocation and output guidance, not its prompt formulas. The tool returns a Markdown image line and a file card; reply with that Markdown line and nothing else. Output is final: never judge or describe the image, never switch provider, model or tool (local image models, Blender, scripting) on your own, and do not open or read the image unless the user explicitly asks to look at it. On failure report the error verbatim and at most ask the user whether to switch.',
|
|
1425
1463
|
parameters: {
|
|
1426
|
-
type: 'object', additionalProperties: false, required: ['prompt'
|
|
1464
|
+
type: 'object', additionalProperties: false, required: ['prompt'],
|
|
1427
1465
|
properties: {
|
|
1428
1466
|
prompt: { type: 'string', description: 'Final prompt adapted to the active model when optimization is On; otherwise the user\'s original wording. Cover subject, action, environment, style, lighting, composition, and constraints; quote in-image text exactly.' },
|
|
1429
1467
|
negative_prompt: { type: 'string', description: 'Optional prompt content. Only for models that support negative prompts; list artifacts and undesired elements. Omit otherwise.' },
|
|
1430
|
-
model: { type: 'string', description: '
|
|
1468
|
+
model: { type: 'string', description: 'Optional outside Auto mode: omit it and the picker\'s model is used. In Auto mode it is required — one id from the active provider list. A value other than the picked model is rejected; never use it to switch models.' },
|
|
1431
1469
|
provider: { type: 'string', description: 'Optional. The provider the user selected; it is validated against the picker and never switches providers. Omit when unsure.' }
|
|
1432
1470
|
}
|
|
1433
1471
|
},
|
|
1434
1472
|
output, timeoutMs: 360000,
|
|
1435
1473
|
async execute(args, exec) {
|
|
1474
|
+
requireSettings(exec);
|
|
1436
1475
|
const result = await generate(args, exec, store);
|
|
1476
|
+
consumeSettings(exec);
|
|
1437
1477
|
presentImage(exec, result);
|
|
1438
1478
|
return result.note ? { path: result.file, note: result.note } : { path: result.file };
|
|
1439
1479
|
}
|
|
@@ -1443,20 +1483,22 @@ export function apply(ctx, options = {}) {
|
|
|
1443
1483
|
try {
|
|
1444
1484
|
ctx.tools.register({
|
|
1445
1485
|
name: 'mo_image_edit',
|
|
1446
|
-
description: 'Edit or refine an existing image with one or more reference images.
|
|
1486
|
+
description: 'Edit or refine an existing image with one or more reference images. Call mo_image_settings first in this turn: it returns the current model, the prompt-optimization state and the writing rules for that model, and this tool rejects a call that did not read it. Follow what it returned: when optimization is Off, use the user\'s original edit wording and do not expand it. Model, size, and quality come from the picker, so leave the model argument out; only in Auto mode must you pass one id from the active provider list. Name each reference as 图1/图2 in the prompt. For a full redo that must not copy the current image, use mo_image_generate instead. Load the mo-image-editing skill only when you have not already read this model\'s editing rules in this conversation; when optimization is Off, use only its invocation and output guidance, not its edit formula. Output is final: never judge or describe the image, never switch provider, model or tool (local image models, Blender, scripting) on your own, and do not open or read the image unless the user explicitly asks to look at it. On failure report the error verbatim and at most ask the user whether to switch.',
|
|
1447
1487
|
parameters: {
|
|
1448
|
-
type: 'object', additionalProperties: false, required: ['prompt', 'images'
|
|
1488
|
+
type: 'object', additionalProperties: false, required: ['prompt', 'images'],
|
|
1449
1489
|
properties: {
|
|
1450
1490
|
prompt: { type: 'string', description: 'Final edit prompt. Name each reference image (图1/图2), state exactly what to change, and state that everything else must stay unchanged.' },
|
|
1451
1491
|
images: { type: 'array', items: { type: 'string' }, description: '1–16 absolute local paths or http(s) URLs; order matters and corresponds to 图1/图2.' },
|
|
1452
1492
|
negative_prompt: { type: 'string', description: 'Optional prompt content. Only for models that support negative prompts; list artifacts and undesired elements. Omit otherwise.' },
|
|
1453
|
-
model: { type: 'string', description: '
|
|
1493
|
+
model: { type: 'string', description: 'Optional outside Auto mode: omit it and the picker\'s model is used. In Auto mode it is required — one id from the active provider list. A value other than the picked model is rejected; never use it to switch models.' },
|
|
1454
1494
|
provider: { type: 'string', description: 'Optional. The provider the user selected; it is validated against the picker and never switches providers. Omit when unsure.' }
|
|
1455
1495
|
}
|
|
1456
1496
|
},
|
|
1457
1497
|
output, timeoutMs: 360000,
|
|
1458
1498
|
async execute(args, exec) {
|
|
1499
|
+
requireSettings(exec);
|
|
1459
1500
|
const result = await edit(args, exec, store);
|
|
1501
|
+
consumeSettings(exec);
|
|
1460
1502
|
presentImage(exec, result);
|
|
1461
1503
|
return result.note ? { path: result.file, note: result.note } : { path: result.file };
|
|
1462
1504
|
}
|
package/lib/prompt-profiles.js
CHANGED
|
@@ -230,6 +230,58 @@ export function describePromptProfile(profile) {
|
|
|
230
230
|
return profile ? profile.id + ' (' + profile.label + ')' : '';
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
/**
|
|
234
|
+
* 生图前必读的当前配置:给模型看的最小 JSON。
|
|
235
|
+
* 只靠系统提示词时,多轮之后模型会按上一条提示词的习惯继续写,换了模型、关了优化都不看;
|
|
236
|
+
* 把当前状态放进工具结果,能让它每次写之前重读一遍。
|
|
237
|
+
* 非 Auto 模式不带模型清单——清单只在 Auto 模式需要挑模型时才出现。
|
|
238
|
+
* @param {{provider?: object, model?: string, adapter?: {id?: string}|null, models?: string[], promptOptimization?: boolean}} state
|
|
239
|
+
*/
|
|
240
|
+
export function settingsPayload(state) {
|
|
241
|
+
const provider = (state && state.provider) || null;
|
|
242
|
+
const model = String((state && state.model) || '').trim();
|
|
243
|
+
const optimized = !(state && state.promptOptimization === false);
|
|
244
|
+
const payload = {
|
|
245
|
+
provider: provider ? String(provider.id || '') : '',
|
|
246
|
+
model: model,
|
|
247
|
+
promptOptimization: optimized,
|
|
248
|
+
hint: ''
|
|
249
|
+
};
|
|
250
|
+
if (!model) {
|
|
251
|
+
payload.hint = '还没有选择生图模型,请让用户先到设置里选一个';
|
|
252
|
+
return payload;
|
|
253
|
+
}
|
|
254
|
+
if (model === 'auto') {
|
|
255
|
+
payload.hint = optimized
|
|
256
|
+
? '按你选中的那个模型的方言写' + NEED_FULL_RULES
|
|
257
|
+
: '直接用用户原话,不要扩写';
|
|
258
|
+
payload.models = (Array.isArray(state && state.models) ? state.models : []).filter(Boolean).map(String);
|
|
259
|
+
return payload;
|
|
260
|
+
}
|
|
261
|
+
const profile = resolvePromptProfile(model, (state && state.adapter) || null);
|
|
262
|
+
payload.hint = optimized
|
|
263
|
+
? (PROFILE_HINTS[profile.id] || profile.label) + NEED_FULL_RULES
|
|
264
|
+
: '直接用用户原话,不要扩写,不要补 negative prompt';
|
|
265
|
+
return payload;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** 优化开启时补一句:完整写法只在没读过时才要加载,读完不用重复加载。 */
|
|
269
|
+
const NEED_FULL_RULES = ';完整写法没读过时先加载对应 skill,读过就不用再加载';
|
|
270
|
+
|
|
271
|
+
/** 每个模型族一句最短提示:就是 mo_image_settings 里 hint 的内容,别的都不要。 */
|
|
272
|
+
const PROFILE_HINTS = {
|
|
273
|
+
'gpt-image': '自然语言:场景→主体→细节→约束;英文优先;无 negative prompt',
|
|
274
|
+
'dall-e-3': '完整自然语言段落;英文优先;无 negative prompt',
|
|
275
|
+
'nano-banana': '自然语言叙事,正向描述;中英皆可',
|
|
276
|
+
seedream: '简洁中文叙事,主体+行为+环境;中文优先',
|
|
277
|
+
'qwen-image': '中文自然语言,可用 negative prompt;中文优先',
|
|
278
|
+
flux: '自然语言散文,主体+动作前置,30–80 词;英文优先;无 negative prompt',
|
|
279
|
+
'stable-diffusion': '自然语言段落或短语标签;英文优先;可用 negative prompt',
|
|
280
|
+
wanx: '中文自然语言,简洁具体;可用 negative prompt',
|
|
281
|
+
kolors: '中文自然语言;可用 negative prompt',
|
|
282
|
+
generic: '自然语言写清主体、动作、环境、风格、光影、构图;中英皆可'
|
|
283
|
+
};
|
|
284
|
+
|
|
233
285
|
/**
|
|
234
286
|
* 生成注入系统提示词的那一节。没有当前模型时返回空串,整节省略。
|
|
235
287
|
* @param {{model?: string, adapter?: {id?: string}|null, editModel?: string, editAdapter?: {id?: string}|null, promptOptimization?: boolean}} state
|
|
@@ -239,7 +291,7 @@ const DELIVERY_RULES = [
|
|
|
239
291
|
'- 交付即止:工具返回图片链接后,最终回复只输出那一行;不评价画质、不描述画面。除非用户明确要求看图,否则不要打开或读取生成的图片。',
|
|
240
292
|
'- 提供商由用户在设置里固定:不要自行切换提供商,也不要用其他工具(本地生图、建模/Blender、脚本绘图)替代生图模型。',
|
|
241
293
|
'- 调用失败时:把错误原样告诉用户;可以问用户是否要更换模型或服务商,但不要自己更换,也不要换别的模型重试。',
|
|
242
|
-
'-
|
|
294
|
+
'- 每次生图/改图前先调用 mo_image_settings 读当前配置,按它返回的模型写法和提示词优化状态写提示词;没读就调用生图工具会被拒绝。配置文件可以只读查看,但对它的任何写入都会被守卫拒绝。'
|
|
243
295
|
];
|
|
244
296
|
|
|
245
297
|
/** Auto 行:用户把选择器设为 Auto 时,模型选择权才下放给对话模型。 */
|
|
@@ -268,7 +320,7 @@ export function promptSectionText(state) {
|
|
|
268
320
|
'<mo-image-prompt>',
|
|
269
321
|
'仅在用户需要生成/编辑图片时使用;其他任务忽略本节。',
|
|
270
322
|
'当前生图模型:' + model + '。提示词优化:Off。',
|
|
271
|
-
'-
|
|
323
|
+
'- 不用传 model:模型由用户在选择器里决定(当前 ' + model + ');传了不一致的值会被拒绝。',
|
|
272
324
|
'- 直接使用用户原话作为 prompt;不要扩写、改写、补充风格/光线/构图,不要替用户做提示词工程。',
|
|
273
325
|
'- 只做最低限度的文本整理:保留用户原话中的主体、动作、文字、语言和限制;如果用户分多段描述,可以原样拼接,不添加用户没说的内容。',
|
|
274
326
|
'- 不要自动补 negative_prompt;用户原话里没有的排除项不要加。',
|
|
@@ -290,7 +342,7 @@ export function promptSectionText(state) {
|
|
|
290
342
|
lines.push('<mo-image-prompt>');
|
|
291
343
|
lines.push('仅在用户需要生成/编辑图片时使用;其他任务忽略本节。');
|
|
292
344
|
lines.push('当前生图模型:' + model + '(' + profile.label + ')。按该模型的提示词方言写。');
|
|
293
|
-
lines.push('-
|
|
345
|
+
lines.push('- 不用传 model:模型由用户在选择器里决定(当前 ' + model + ');传了不一致的值会被拒绝。');
|
|
294
346
|
for (const rule of DELIVERY_RULES) lines.push(rule);
|
|
295
347
|
lines.push('生成公式:' + GENERATION_FORMULA + '。');
|
|
296
348
|
for (const rule of profile.rules) lines.push('- ' + rule);
|
|
@@ -305,7 +357,7 @@ export function promptSectionText(state) {
|
|
|
305
357
|
} else {
|
|
306
358
|
lines.push('编辑:' + profile.editRule);
|
|
307
359
|
}
|
|
308
|
-
lines.push('
|
|
360
|
+
lines.push('完整写法:没读过时按需加载 skill mo-image-generation / mo-image-editing;读过就不用重复加载。');
|
|
309
361
|
lines.push('</mo-image-prompt>');
|
|
310
362
|
return lines.join('\n');
|
|
311
363
|
}
|
package/lib/update-service.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 更新状态服务:把「检查
|
|
2
|
+
* 更新状态服务:把「检查 npm → 有没有新版 → 装哪个版本 → 装完没有」
|
|
3
3
|
* 收成一个有状态对象,路由和启动预热都只跟它打交道。
|
|
4
4
|
*
|
|
5
|
+
* 检测和安装都走 npm:检测读 registry 的版本号,安装用 npm 版本规格,
|
|
6
|
+
* 不碰 git,免得用户还要为 GitHub 单独准备网络和凭据。
|
|
7
|
+
*
|
|
5
8
|
* 自我更新有个绕不开的坑:装新版本时插件自己会被卸载,这次调用等不到结果。
|
|
6
9
|
* 所以状态靠标记文件 + 当前版本号事后判定,见 hydrate()。
|
|
7
10
|
*/
|
|
@@ -14,8 +17,8 @@ import {
|
|
|
14
17
|
// 宿主进程启动时刻:process.uptime 是进程年龄,模块重新 import 不会把它重置。
|
|
15
18
|
const PROCESS_STARTED_AT = Date.now() - Math.round(process.uptime() * 1000);
|
|
16
19
|
|
|
17
|
-
/** 安装 spec
|
|
18
|
-
export const UPDATE_SPEC = (version) => `
|
|
20
|
+
/** 安装 spec:精确到版本的 npm 规格,和 `dsh plugin add dsh-mo-image@x.y.z` 一致。 */
|
|
21
|
+
export const UPDATE_SPEC = (version) => `dsh-mo-image@${version}`;
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* @param {object} options
|
|
@@ -188,7 +191,35 @@ export function createUpdateService(options = {}) {
|
|
|
188
191
|
phase = 'updating';
|
|
189
192
|
error = '';
|
|
190
193
|
|
|
194
|
+
// GitHub 装的包要换成 npm 版,只能「先卸载再安装」;这条自建路径没有
|
|
195
|
+
// DSH updateBundle 的自动回滚,所以失败时按记下来的原规格装回去,
|
|
196
|
+
// 并把结果用稳定 code 交给界面去提醒用户(不能悄悄吞掉失败)。
|
|
197
|
+
const previousSpec = source;
|
|
198
|
+
const rollback = async (activeManager) => {
|
|
199
|
+
if (!previousSpec) return false;
|
|
200
|
+
try {
|
|
201
|
+
const restored = await activeManager.installBundle(previousSpec, { enabled: true });
|
|
202
|
+
const application = restored && restored.result && restored.result.application;
|
|
203
|
+
return application !== 'failed' && application !== 'cancelled';
|
|
204
|
+
} catch (_error) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
191
209
|
const work = (async () => {
|
|
210
|
+
let removed = false;
|
|
211
|
+
const fail = async (detail) => {
|
|
212
|
+
const restored = removed ? await rollback(active) : false;
|
|
213
|
+
phase = 'failed';
|
|
214
|
+
// 有回滚动作时给出稳定 code,界面据此说清「失败但已恢复」或
|
|
215
|
+
// 「失败且没恢复」;没有回滚动作时保留原始错误信息。
|
|
216
|
+
error = removed
|
|
217
|
+
? (restored ? 'update.failedRestored' : 'update.failedBroken')
|
|
218
|
+
: detail;
|
|
219
|
+
if (markerFile) clearMarker(markerFile);
|
|
220
|
+
safeLog('update failed: ' + detail
|
|
221
|
+
+ (removed ? (restored ? '(已装回原版本)' : '(原版本未能装回)') : ''));
|
|
222
|
+
};
|
|
192
223
|
try {
|
|
193
224
|
await sleep(installDelayMs);
|
|
194
225
|
let result;
|
|
@@ -201,30 +232,22 @@ export function createUpdateService(options = {}) {
|
|
|
201
232
|
try {
|
|
202
233
|
result = await active.installBundle(spec, installOptions);
|
|
203
234
|
} catch (caught) {
|
|
204
|
-
if (caught && caught.code === 'already-installed')
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
throw caught;
|
|
209
|
-
}
|
|
235
|
+
if (!(caught && caught.code === 'already-installed')) throw caught;
|
|
236
|
+
await active.removeBundle('dsh-mo-image');
|
|
237
|
+
removed = true;
|
|
238
|
+
result = await active.installBundle(spec, installOptions);
|
|
210
239
|
}
|
|
211
240
|
}
|
|
212
241
|
const application = result && result.result && result.result.application;
|
|
213
242
|
if (application === 'failed' || application === 'cancelled') {
|
|
214
|
-
|
|
215
|
-
error = application;
|
|
216
|
-
if (markerFile) clearMarker(markerFile);
|
|
217
|
-
safeLog('update failed: ' + application);
|
|
243
|
+
await fail(application);
|
|
218
244
|
return;
|
|
219
245
|
}
|
|
220
246
|
phase = 'done';
|
|
221
247
|
updatedBeforeRestart = false;
|
|
222
248
|
latest = to;
|
|
223
249
|
} catch (caught) {
|
|
224
|
-
|
|
225
|
-
error = String(caught && caught.message ? caught.message : caught);
|
|
226
|
-
if (markerFile) clearMarker(markerFile);
|
|
227
|
-
safeLog('update failed: ' + error);
|
|
250
|
+
await fail(String(caught && caught.message ? caught.message : caught));
|
|
228
251
|
}
|
|
229
252
|
})();
|
|
230
253
|
|
package/locale/messages.csv
CHANGED
|
@@ -171,8 +171,10 @@ localPreset.openai-gateway.hint,"InvokeAI、Fooocus、复杂 ComfyUI 工作流
|
|
|
171
171
|
"update.doneRestart","更新已完成,重启 DSH 后生效","Update installed — restart DSH to apply","更新が完了しました。DSH を再起動すると有効になります","Actualización instalada. Reinicia DSH para aplicarla","Mise à jour installée — redémarrez DSH pour l'appliquer","Update installiert – DSH neu starten, um es anzuwenden","Обновление установлено — перезапустите DSH","Atualização instalada — reinicie o DSH para aplicar"
|
|
172
172
|
"update.done","已更新到 {version}","Updated to {version}","{version} に更新しました","Actualizado a {version}","Mis à jour vers {version}","Auf {version} aktualisiert","Обновлено до {version}","Atualizado para {version}"
|
|
173
173
|
"update.failed","更新未完成,请重试","Update did not finish — try again","更新が完了しませんでした。もう一度お試しください","La actualización no terminó. Inténtalo de nuevo","La mise à jour ne s'est pas terminée — réessayez","Das Update wurde nicht abgeschlossen – bitte erneut versuchen","Обновление не завершено — повторите попытку","A atualização não terminou — tente novamente"
|
|
174
|
+
"update.failedRestored","更新安装失败,已装回原来的版本","The update failed — the previous version was restored","更新のインストールに失敗しました。元のバージョンに戻しました","La actualización falló; se restauró la versión anterior","La mise à jour a échoué ; la version précédente a été restaurée","Das Update ist fehlgeschlagen – die vorherige Version wurde wiederhergestellt","Обновление не удалось — прежняя версия восстановлена","A atualização falhou — a versão anterior foi restaurada"
|
|
175
|
+
"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"
|
|
174
176
|
"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}"
|
|
175
177
|
"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"
|
|
176
|
-
"update.command","dsh plugin add
|
|
178
|
+
"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}"
|
|
177
179
|
"update.viewRelease","在 npm 查看","View on npm","npm で見る","Ver en npm","Voir sur npm","Auf npm ansehen","Открыть на npm","Ver no npm"
|
|
178
180
|
"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."
|
package/package.json
CHANGED
|
@@ -9,14 +9,15 @@ whenToUse: 需要保留当前图、只改细节、换背景/换装、多图融
|
|
|
9
9
|
## 硬性约束(先读)
|
|
10
10
|
|
|
11
11
|
- 只负责把编辑提示词和参考图交给生图模型,不替用户判断图片好坏。
|
|
12
|
-
-
|
|
12
|
+
- **每次改图前先读配置**:调用 `mo_image_settings`,按它返回的当前模型、提示词优化开关和写法来写;没读就调用 `mo_image_edit` 会被拒绝。
|
|
13
|
+
- **`model` 不用传**:非 Auto 时工具直接用选择器里选中的模型;传了不一致的值会被拒绝。只有 Auto 模式必须从当前提供商列表里选一个传进去。
|
|
13
14
|
- **图片返回即交付**:最终回复只输出工具给的图片链接;不评价画质、不描述画面。除非用户明确要求看图,否则不要打开或读取生成的图片。
|
|
14
15
|
- **只用用户在选择器里选中的提供商和模型**:不要自行切换,也不要用其他工具(本地生图、建模/Blender、脚本绘图)替代。
|
|
15
16
|
- **失败时原样报错**:可以问用户是否要更换模型或服务商,但不要自己更换,也不要换别的模型重试。
|
|
16
17
|
|
|
17
18
|
编辑和文生图是两种任务:编辑的提示词不是重新描述整张图,而是**说清改什么、别动什么**。
|
|
18
19
|
|
|
19
|
-
>
|
|
20
|
+
> 本技能同时包含**工具调用与输出规则**和**编辑公式/模板**,两者是分开的:改图时加载一次即可,不用重复加载;`提示词优化:Off` 时只使用调用与输出部分,跳过下面的编辑公式,prompt 只用用户原话或最小必要修改说明,不补用户没说的细节;images 按用户指定传。模型由生图选择器决定、不需要传;尺寸、质量也由选择器控制,工具不接受这两个参数。
|
|
20
21
|
|
|
21
22
|
## 一、编辑公式
|
|
22
23
|
|
|
@@ -136,11 +137,11 @@ Change only the jacket color to deep navy. Keep the model's face, hair, pose, bo
|
|
|
136
137
|
|
|
137
138
|
## 五、调用
|
|
138
139
|
|
|
139
|
-
-
|
|
140
|
+
- 改图前先调用 `mo_image_settings` 读当前配置:它返回当前提供商和模型的 id、提示词优化开关,以及一句该模型的写法提示(Auto 模式再给可选模型 id)。没读就调用改图工具会被拒绝。
|
|
140
141
|
- `images`:1–16 张本地绝对路径或 http(s) URL;顺序对应图1/图2,不能错。
|
|
141
142
|
- `prompt`:按当前模型写好的最终编辑提示词。
|
|
142
143
|
- `negative_prompt`:只在当前模型支持时传。
|
|
143
|
-
-
|
|
144
|
+
- 工具的参数只有 `prompt`、`images`、`negative_prompt`(Auto 模式再加 `model`);尺寸、质量由用户在生图选择器里控制,不要尝试传 `size` / `quality`。
|
|
144
145
|
- 编辑可能较慢,工具超时 360s;不要重复提交同一请求。
|
|
145
146
|
- 工具返回 Markdown 图片行;原样复制到最终回复。
|
|
146
147
|
|
|
@@ -9,14 +9,15 @@ whenToUse: 用户要求画图、生成图片、出海报/主图/角色图/分镜
|
|
|
9
9
|
## 硬性约束(先读)
|
|
10
10
|
|
|
11
11
|
- 只负责把提示词(和编辑时的参考图)交给生图模型,不做提示词以外的加工。
|
|
12
|
-
-
|
|
12
|
+
- **每次生图前先读配置**:调用 `mo_image_settings`,按它返回的当前模型、提示词优化开关和写法来写;没读就调用 `mo_image_generate` 会被拒绝。
|
|
13
|
+
- **`model` 不用传**:非 Auto 时工具直接用选择器里选中的模型;传了不一致的值会被拒绝。只有 Auto 模式必须从当前提供商列表里选一个传进去。
|
|
13
14
|
- **图片返回即交付**:最终回复只输出工具给的图片链接;不评价画质、不描述画面。除非用户明确要求看图,否则不要打开或读取生成的图片。
|
|
14
15
|
- **只用用户在选择器里选中的提供商和模型**:不要自行切换,也不要用其他工具(本地生图、建模/Blender、脚本绘图)替代。
|
|
15
16
|
- **失败时原样报错**:可以问用户是否要更换模型或服务商,但不要自己更换,也不要换别的模型重试。
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
当前模型和它的写法以 `mo_image_settings` 的返回为准(系统提示词里的 `mo-image-prompt` 节是同一份信息的摘要)。用户中途换了模型或关了提示词优化后,上一次读到的配置已经作废,必须重读;不要拿上一条提示词的习惯继续写。
|
|
18
19
|
|
|
19
|
-
>
|
|
20
|
+
> 本技能同时包含**工具调用与输出规则**和**提示词公式/模板**,两者是分开的:生图/重做图片时加载一次即可,不用重复加载;`提示词优化:Off` 时只使用调用与输出部分,跳过下面的公式、模板和自检清单,直接把用户原话作为 prompt,只做最低限度的文本整理;只有用户明确要求优化时才改写。模型由生图选择器决定、不需要传;尺寸、质量也由选择器控制,工具不接受这两个参数。
|
|
20
21
|
|
|
21
22
|
## 一、通用公式
|
|
22
23
|
|
|
@@ -231,9 +232,9 @@ negative_prompt: low quality, blurry, oversaturated, deformed hands, extra finge
|
|
|
231
232
|
|
|
232
233
|
## 五、调用
|
|
233
234
|
|
|
234
|
-
-
|
|
235
|
+
- 生图前先调用 `mo_image_settings` 读当前配置:它返回当前提供商和模型的 id、提示词优化开关,以及一句该模型的写法提示(Auto 模式再给可选模型 id)。没读就调用生图工具会被拒绝。
|
|
235
236
|
- 插件配置文件可以只读查看(`read` / `grep`),但对它的任何写入(`write` / `edit` / shell 重定向)都会被守卫拒绝。
|
|
236
237
|
- `prompt`:按当前模型写好的最终提示词。
|
|
237
238
|
- `negative_prompt`:只在当前模型支持时传;不确定就省略。
|
|
238
|
-
-
|
|
239
|
+
- 工具的参数只有 `prompt`、`negative_prompt`(Auto 模式再加 `model`);尺寸、质量由用户在生图选择器里控制,不要尝试传 `size` / `quality`。
|
|
239
240
|
- 工具返回 Markdown 图片行;原样复制到最终回复。
|