dsh-mo-image 0.7.0 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mo-image",
3
- "version": "0.7.0",
3
+ "version": "1.0.1",
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",
@@ -61,7 +61,7 @@ export function distTag(version) {
61
61
  /**
62
62
  * 算下一个版本号。
63
63
  * @param {string} current 当前版本
64
- * @param {string} kind patch|minor|major 或一个明确的新版本
64
+ * @param {string} kind patch|minor|major 或明确版本(相同版本由主流程验证能否续发)
65
65
  * @returns {string}
66
66
  */
67
67
  export function nextVersion(current, kind) {
@@ -75,7 +75,9 @@ export function nextVersion(current, kind) {
75
75
  const explicit = SEMVER.exec(String(kind || '').replace(/-latest$/i, ''));
76
76
  if (explicit) {
77
77
  const normalized = `${explicit[1]}.${explicit[2]}.${explicit[3]}${explicit[4] ? '-' + explicit[4] : ''}`;
78
- if (compareVersions(normalized, current) !== 1) throw new Error(`${normalized} is not newer than ${current}`);
78
+ if (normalized !== current && compareVersions(normalized, current) !== 1) {
79
+ throw new Error(`${normalized} is not newer than ${current}`);
80
+ }
79
81
  return normalized;
80
82
  }
81
83
  throw new Error(`unknown release kind: ${kind}`);
@@ -129,15 +131,18 @@ export function parseCommit(subject) {
129
131
  */
130
132
  export function releasePlan(version) {
131
133
  const tag = `v${version}`;
134
+ const ref = `refs/tags/${tag}`;
132
135
  return [
133
- { command: 'git', args: ['add', 'package.json', 'CHANGELOG.md'] },
134
- { command: 'git', args: ['commit', '-m', `chore(release): ${tag}`] },
136
+ { command: 'git', args: ['commit', '--only', '-m', `chore(release): ${tag}`, '--', 'package.json', 'CHANGELOG.md'] },
135
137
  { command: 'git', args: ['tag', '-a', tag, '-m', tag] },
136
- { command: 'git', args: ['push'] },
137
- { command: 'git', args: ['push', '--tags'] }
138
+ { command: 'git', args: ['push', '--atomic', 'origin', `${ref}^{commit}:refs/heads/${BRANCH}`, `${ref}:${ref}`] }
138
139
  ];
139
140
  }
140
141
 
142
+ export function isPreparedRelease(current, next, head, tagCommit) {
143
+ return current === next && Boolean(head) && tagCommit === head;
144
+ }
145
+
141
146
  function run(command, args, options = {}) {
142
147
  const result = spawnSync(command, args, {
143
148
  cwd: ROOT,
@@ -199,13 +204,13 @@ function readVersion() {
199
204
  return JSON.parse(readFileSync(PACKAGE_PATH, 'utf8')).version;
200
205
  }
201
206
 
202
- function lastTag() {
203
- return capture('git', ['describe', '--tags', '--abbrev=0', '--match', 'v*']);
207
+ function lastTag(ref = 'HEAD') {
208
+ return capture('git', ['describe', '--tags', '--abbrev=0', '--match', 'v*', ref]);
204
209
  }
205
210
 
206
- function collectCommits(sinceTag) {
207
- const range = sinceTag ? `${sinceTag}..HEAD` : '-30';
208
- const log = capture('git', ['log', range, '--pretty=%s']);
211
+ function collectCommits(sinceTag, ref = 'HEAD') {
212
+ const range = sinceTag ? [`${sinceTag}..${ref}`] : ['-30', ref];
213
+ const log = capture('git', ['log', ...range, '--pretty=%s']);
209
214
  return log.split('\n').map((line) => line.trim()).filter(Boolean).map(parseCommit);
210
215
  }
211
216
 
@@ -254,7 +259,7 @@ export function createRelease(version, notes, options = {}) {
254
259
  try {
255
260
  const gh = ghReady();
256
261
  if (gh) {
257
- const args = ['release', 'create', tag, '--title', tag, '--notes-file', file];
262
+ const args = ['release', 'create', tag, '--verify-tag', '--title', tag, '--notes-file', file];
258
263
  if (prerelease) args.push('--prerelease');
259
264
  return run(gh, args).status === 0;
260
265
  }
@@ -291,14 +296,14 @@ function releaseOnly(args) {
291
296
  console.error(`tag ${tag} 不存在;先跑一次完整发版,或手动打 tag`);
292
297
  return 1;
293
298
  }
294
- const previous = capture('git', ['describe', '--tags', '--abbrev=0', '--match', 'v*', `${tag}^`]);
299
+ const previous = lastTag(`${tag}^`);
295
300
  const changelogPath = path.join(ROOT, 'CHANGELOG.md');
296
301
  const notes = notesForRelease({
297
302
  version,
298
303
  notes: args.notes,
299
304
  notesFileText: args.notesFile ? readFileSync(path.resolve(ROOT, args.notesFile), 'utf8') : '',
300
305
  changelog: existsSync(changelogPath) ? readFileSync(changelogPath, 'utf8') : '',
301
- commits: collectCommits(previous)
306
+ commits: collectCommits(previous, tag)
302
307
  });
303
308
  const fromChangelog = !args.notes.trim() && !args.notesFile && parseChangelogFor(
304
309
  existsSync(changelogPath) ? readFileSync(changelogPath, 'utf8') : '', version
@@ -309,6 +314,13 @@ function releaseOnly(args) {
309
314
  console.log(notes || '(no notes)');
310
315
  return 0;
311
316
  }
317
+ const ref = `refs/tags/${tag}`;
318
+ const remote = capture('git', ['ls-remote', '--exit-code', '--refs', 'origin', ref]);
319
+ const local = capture('git', ['rev-parse', '--verify', ref]);
320
+ if (!local || remote !== `${local}\t${ref}`) {
321
+ console.error(`无法确认远端 ${tag} 与本地一致,请用明确版本重试完整发版。`);
322
+ return 1;
323
+ }
312
324
  if (!createRelease(version, notes, { dryRun: false })) {
313
325
  console.error(`tag ${tag} 已存在,但 GitHub Release 没有建成`);
314
326
  return 1;
@@ -369,7 +381,7 @@ export function upsertChangelog(text, version, notes) {
369
381
  }
370
382
 
371
383
  /**
372
- * 发到 npm。返回是否成功(失败不阻止建 Release,但退出码会是 1)。
384
+ * 发到 npm。调用方只在发布成功后建立 GitHub Release。
373
385
  * @param {string} version
374
386
  * @returns {boolean}
375
387
  */
@@ -384,10 +396,15 @@ function publishToNpm(version) {
384
396
  console.log(`npm 已发布 ${version}`);
385
397
  return true;
386
398
  }
387
- console.error(`npm publish 失败;tag 已经推送。修好后手动执行:npm publish --tag ${tag}`);
399
+ console.error(`npm publish 失败。修复后用明确版本重试:npm run release -- ${version} --publish`);
388
400
  return false;
389
401
  }
390
402
 
403
+ export function publishReleaseArtifacts(version, notes, { publish = false, npm = publishToNpm, github = createRelease } = {}) {
404
+ if (publish && !npm(version)) return 'npm-failed';
405
+ return github(version, notes) ? 'released' : 'github-failed';
406
+ }
407
+
391
408
  /**
392
409
  * 主流程。
393
410
  * @param {string[]} argv
@@ -395,6 +412,10 @@ function publishToNpm(version) {
395
412
  */
396
413
  export function main(argv = process.argv.slice(2)) {
397
414
  const args = parseArgs(argv);
415
+ if (args.releaseOnly && args.publish) {
416
+ console.error('补建 GitHub Release 不发布 npm 包。用明确版本加 --publish 继续发版。');
417
+ return 1;
418
+ }
398
419
  if (args.releaseOnly) return releaseOnly(args);
399
420
  if (args.help || !args.kind) {
400
421
  console.log('usage: node scripts/release.mjs <patch|minor|major|x.y.z|x.y.z-rc1> [--dry-run] [--publish] [--notes "..."] [--notes-file file]');
@@ -403,8 +424,19 @@ export function main(argv = process.argv.slice(2)) {
403
424
  }
404
425
  const current = readVersion();
405
426
  const next = nextVersion(current, args.kind);
406
- if (next === current) throw new Error('the new version equals the current one');
407
427
  const tag = `v${next}`;
428
+ const tagRef = `refs/tags/${tag}`;
429
+ const head = capture('git', ['rev-parse', '--verify', 'HEAD']);
430
+ const tagCommit = capture('git', ['rev-parse', '--verify', `${tagRef}^{commit}`]);
431
+ const resume = isPreparedRelease(current, next, head, tagCommit);
432
+ if (next === current && !resume) {
433
+ console.error(`继续发版需要 ${tag} 指向当前 HEAD,并且 package.json 使用同一个版本。`);
434
+ return 1;
435
+ }
436
+ if (!resume && capture('git', ['tag', '--list', tag])) {
437
+ console.error(`tag ${tag} already exists`);
438
+ return 1;
439
+ }
408
440
  if (isHiddenPrerelease(next)) {
409
441
  console.log(`${next} 是 alpha/beta:会标成 prerelease,已装用户不会收到更新提示。`);
410
442
  }
@@ -417,17 +449,18 @@ export function main(argv = process.argv.slice(2)) {
417
449
  notes: args.notes,
418
450
  notesFileText: args.notesFile ? readFileSync(path.resolve(ROOT, args.notesFile), 'utf8') : '',
419
451
  changelog: changelogText,
420
- commits: collectCommits(lastTag())
452
+ commits: collectCommits(lastTag(resume ? `${tag}^` : 'HEAD'))
421
453
  });
422
454
  if (!args.notes.trim() && !args.notesFile && parseChangelogFor(changelogText, next)) {
423
455
  console.log(`使用 CHANGELOG.md 里 v${next} 的说明`);
424
456
  }
425
457
  const plan = releasePlan(next);
458
+ const push = plan.at(-1);
426
459
 
427
460
  if (args.dryRun) {
428
- console.log(`release ${current} → ${next}`);
461
+ console.log(resume ? `resume release ${tag}` : `release ${current} → ${next}`);
429
462
  console.log(` node --test (tests)`);
430
- for (const step of plan) console.log(` ${step.command} ${step.args.join(' ')}`);
463
+ for (const step of resume ? [push] : plan) console.log(` ${step.command} ${step.args.join(' ')}`);
431
464
  if (args.publish) console.log(` npm publish --tag ${distTag(next)}`);
432
465
  console.log(` (github release ${tag})\n`);
433
466
  console.log(notes || '(no notes)');
@@ -444,15 +477,7 @@ export function main(argv = process.argv.slice(2)) {
444
477
  return 1;
445
478
  }
446
479
 
447
- // 上一次发版可能已经 bump + 打了 tag、只是推送/建 Release 时失败:
448
- // 这种情况下不重做前面的步骤,直接从推送继续。
449
- const resume = capture('git', ['tag', '--list', tag]) !== '' && current === next;
450
- if (resume) {
451
- console.log(`检测到 ${tag} 已存在且版本号已是 ${next}:接着上次没做完的推送与 Release`);
452
- } else if (capture('git', ['tag', '--list', tag])) {
453
- console.error(`tag ${tag} already exists`);
454
- return 1;
455
- }
480
+ if (resume) console.log(`继续发布已准备好的 ${tag}。`);
456
481
  const ghCli = ghReady();
457
482
  if (ghCli && run(ghCli, ['release', 'view', tag], { capture: true }).status === 0) {
458
483
  console.error(`release ${tag} already exists`);
@@ -464,62 +489,52 @@ export function main(argv = process.argv.slice(2)) {
464
489
  if (resume) console.error(`版本号已经是 ${next};修好测试后重跑本命令会从推送继续`);
465
490
  return 1;
466
491
  }
467
-
468
- const baseSha = capture('git', ['rev-parse', 'HEAD']);
469
- /** 推送之前失败:把本地改动恢复原样,用户可以直接重试。 */
470
- const rollback = (reason) => {
471
- console.error(`\n发版失败:${reason}`);
472
- run('git', ['tag', '-d', tag], { capture: true });
473
- const reset = run('git', ['reset', '--hard', baseSha], { capture: true });
474
- if (!reset.error && reset.status === 0) console.error(`已回退本地改动(回到 ${baseSha.slice(0, 7)}),可以直接重试`);
475
- else console.error(`自动回退没有成功,请手动执行:git reset --hard ${baseSha} && git tag -d ${tag}`);
492
+ if (capture('git', ['rev-parse', '--verify', 'HEAD']) !== head
493
+ || capture('git', ['rev-parse', '--abbrev-ref', 'HEAD']) !== branch
494
+ || capture('git', ['status', '--porcelain'])) {
495
+ console.error('测试期间分支、提交或工作区发生了变化,请检查后重新执行发版。');
476
496
  return 1;
477
- };
497
+ }
478
498
 
479
499
  if (!resume) {
480
500
  const pkg = JSON.parse(readFileSync(PACKAGE_PATH, 'utf8'));
481
501
  pkg.version = next;
482
502
  writeFileSync(PACKAGE_PATH, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
483
503
  // 说明同时写进 CHANGELOG.md:它会随包发布,更新对话框从那里读。
484
- const changelogPath = path.join(ROOT, 'CHANGELOG.md');
485
- const existing = existsSync(changelogPath) ? readFileSync(changelogPath, 'utf8') : '';
486
- writeFileSync(changelogPath, upsertChangelog(existing, next, notes), 'utf8');
504
+ writeFileSync(changelogPath, upsertChangelog(changelogText, next, notes), 'utf8');
487
505
 
488
- // 只做本地那三步(add / commit / tag),推送单独处理,好在失败时回退。
489
- for (const step of plan.slice(0, 3)) {
506
+ for (const step of plan.slice(0, -1)) {
490
507
  if (run(step.command, step.args).status !== 0) {
491
- return rollback(`${step.command} ${step.args[0]} 失败`);
508
+ console.error(`${step.command} ${step.args[0]} 失败,本地保留当前状态。检查发版文件和提交,准备好 ${tag} 后用明确版本继续。`);
509
+ return 1;
492
510
  }
493
511
  }
494
512
  }
495
513
 
496
- // 先推分支:这一步失败说明远端还没变,可以安全回退。
497
- if (run('git', ['push', 'origin', BRANCH]).status !== 0) {
498
- console.error('\n推送分支失败(网络 / 凭据)');
499
- if (resume) {
500
- console.error(`本地停在 ${tag},远端未更新;修好网络后重跑本命令会从推送继续`);
501
- return 1;
502
- }
503
- return rollback('git push 失败');
514
+ const preparedCommit = capture('git', ['rev-parse', '--verify', `${tagRef}^{commit}`]);
515
+ if (!isPreparedRelease(readVersion(), next, capture('git', ['rev-parse', '--verify', 'HEAD']), preparedCommit)) {
516
+ console.error(`当前版本或提交与 ${tag} 不一致,请检查本地发版状态。`);
517
+ return 1;
504
518
  }
505
-
506
- // 再单独推 tag:失败时分支已经上去了,不能再回退本地,改为提示补推。
507
- if (run('git', ['push', 'origin', `refs/tags/${tag}`]).status !== 0) {
508
- console.error(`\n分支已推送,但 tag ${tag} 推送失败(网络 / 凭据)`);
509
- console.error(`恢复网络后执行:git push origin refs/tags/${tag},然后 node scripts/release.mjs --release-only`);
519
+ if (run(push.command, push.args).status !== 0) {
520
+ console.error(`无法确认分支与 ${tag} 的推送结果,已保留本地提交和标签。`);
521
+ console.error(`检查远端后用明确版本重试:npm run release -- ${next}${args.publish ? ' --publish' : ''}`);
510
522
  return 1;
511
523
  }
512
-
513
- let published = true;
514
- if (args.publish) published = publishToNpm(next);
515
-
516
- if (!createRelease(next, notes, { dryRun: false })) {
524
+ if (args.publish && (capture('git', ['rev-parse', '--verify', 'HEAD']) !== preparedCommit
525
+ || capture('git', ['status', '--porcelain']))) {
526
+ console.error('推送期间提交或工作区发生了变化。请检查后从原发版提交继续发布 npm 包。');
527
+ return 1;
528
+ }
529
+ const publication = publishReleaseArtifacts(next, notes, { publish: args.publish });
530
+ if (publication === 'npm-failed') return 1;
531
+ if (publication === 'github-failed') {
517
532
  console.error(`\ntag ${tag} 已推送,但 GitHub Release 没有建成`);
518
533
  console.error('凭据齐了之后执行:node scripts/release.mjs --release-only');
519
534
  return 1;
520
535
  }
521
536
  console.log(`\nreleased ${tag}`);
522
- return published ? 0 : 1;
537
+ return 0;
523
538
  }
524
539
 
525
540
  if (import.meta.url === pathToFileURL(process.argv[1] || '').href) {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: mo-image-editing
3
- description: 局部修改、参考图融合和版本迭代时加载,包含工具调用、输出规则、编辑公式和按模型写法。
4
- whenToUse: 需要保留当前图、只改细节、换背景/换装、多图融合或把生成图作为参考时。
3
+ description: 改图或多参考图融合时,上下文缺少所需的编辑模板或模型写法才加载;已有指引直接复用。优化关闭时按工具说明调用。
4
+ whenToUse: 修改或融合参考图时,需要当前上下文中没有的编辑模板或模型写法。
5
5
  ---
6
6
 
7
7
  # 图片编辑与版本迭代
@@ -9,13 +9,14 @@ whenToUse: 需要保留当前图、只改细节、换背景/换装、多图融
9
9
  ## 硬性约束(先读)
10
10
 
11
11
  - 只负责把编辑提示词和参考图交给生图模型,不替用户判断图片好坏。
12
- - 改图前确认配置最新:系统提示词的「配置状态」说没读过或刚改过,就先调用 `mo_image_settings`;状态一致直接改图,别重复读。漏了也不会报错——工具返回 `{"path":"","needsSettings":true,"settings":…}`,按它重写再调一次即可。
12
+ - 本会话首次生图或改图前调用 `mo_image_settings`。之后直接调用 `mo_image_edit`,由工具通过 `needsSettings` 返回变更或校准配置。使用返回的完整设置,或在 `baseRevision` 上应用 `changes`、清除 `removed`,然后发起新调用。应用增量时找不到基线才用 `refresh:true` 读取完整配置。
13
+ - 自动模型使用 `editModelIndexes` 从 `models` 选择,也可以省略 `model` 使用首个可改图的候选。需要具体尺寸、质量或参数时,传候选的模型 ID 查询。
13
14
  - `model` 不用传:非 Auto 时用选择器里的模型,传别的值会被拒绝;Auto 必须从当前列表里选一个。
14
15
  - 图片返回即交付:最终回复只输出工具给的图片行;不评价画质、不描述画面。除非用户明确要求看图,否则不要打开或读取图片。
15
16
  - 只用选择器里的提供商和模型:不要自行切换,也不要用本地生图、建模/Blender、脚本绘图替代。
16
- - 失败时原样报错:可以问用户是否换模型或服务商,但不要自己换、也不要换模型重试。
17
+ - 收到「生图配置不匹配(未提交)」时,用 `mo_image_settings({"refresh":true})` 重读完整配置,纠正参数后只重试一次。仍失败或遇到其他错误时原样报错。沿用用户选定的提供商和模型。
17
18
 
18
- 编辑的提示词不是重新描述整张图,而是**说清改什么、别动什么**。`提示词优化:Off` 时只用下面的调用与输出规则,跳过编辑公式:prompt 只写用户原话或最小必要修改,images 按用户指定传。
19
+ 优化开启时,在提示词里**说清改什么、保留什么**。复用上下文已有的写法和合适的成稿。优化关闭时,prompt 只写用户原话或做最低限度整理;用户明确要求优化时才改写。两种模式都按用户指定的顺序传参考图。
19
20
 
20
21
  ## 一、编辑公式
21
22
 
@@ -104,12 +105,5 @@ Use Image 1 as the base. Replace only the background with a soft light-gray seam
104
105
 
105
106
  - 改图前确认配置最新(同「硬性约束」);`images` 是 1–16 张本地绝对路径或 http(s) URL,顺序对应图1/图2,不能错。
106
107
  - `prompt`:按当前模型写好的最终编辑提示词;`negative_prompt`:只在当前模型支持时传。
107
- - 工具参数只有 `prompt`、`images`、`negative_prompt`(Auto 再加 `model`);尺寸、质量由选择器控制,不要传 `size` / `quality`。
108
+ - 选择器把尺寸或质量设为自动时,可传相应的 `size` 或 `quality`,质量取值见 `qualityOptions`。固定时省略相应参数。
108
109
  - 编辑可能较慢,工具超时 360s,不要重复提交同一请求;返回 Markdown 图片行,原样复制到最终回复。
109
-
110
- ## 七、失败
111
-
112
- - 400 提到 image:工具会自动换字段重试一次。
113
- - 400 提到 model:换一个支持编辑的模型,例如 `gpt-image-2.5-sunburst`。
114
- - 401:检查设置里的 API Key。
115
- - 413:减少参考图或压缩到 15MB 以下。
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: mo-image-generation
3
- description: 生成或重做图片时加载,包含工具调用、输出规则和按模型区分的提示词公式、模板与自检清单。
4
- whenToUse: 用户要求画图、生成图片、出海报/主图/角色图/分镜,或需要重做一版时。
3
+ description: 生图或重做时,上下文缺少所需的提示词模板、模型写法或调参指引才加载;已有指引直接复用。优化关闭时按工具说明调用。
4
+ whenToUse: 生成或重做图片时,需要当前上下文中没有的模板、模型写法或调参指引。
5
5
  ---
6
6
 
7
7
  # 生图提示词
@@ -9,13 +9,14 @@ whenToUse: 用户要求画图、生成图片、出海报/主图/角色图/分镜
9
9
  ## 硬性约束(先读)
10
10
 
11
11
  - 只负责把提示词交给生图模型,不做提示词以外的加工。
12
- - 生图前确认配置最新:系统提示词的「配置状态」说没读过或刚改过,就先调用 `mo_image_settings`;状态一致直接生图,别重复读。漏了也不会报错——工具返回 `{"path":"","needsSettings":true,"settings":…}`,按它重写再调一次即可。
12
+ - 本会话首次生图或改图前调用 `mo_image_settings`。之后直接调用 `mo_image_generate`,由工具通过 `needsSettings` 返回变更或校准配置。使用返回的完整设置,或在 `baseRevision` 上应用 `changes`、清除 `removed`,然后发起新调用。应用增量时找不到基线才用 `refresh:true` 读取完整配置。
13
+ - 自动模型从 `models` 选择。需要确认候选的尺寸、质量或参数时,给 `mo_image_settings` 传入该模型 ID。仅在相应模式为 `auto` 时传 `size` 或 `quality`,质量从 `qualityOptions` 选。
13
14
  - `model` 不用传:非 Auto 时用选择器里的模型,传别的值会被拒绝;Auto 必须从当前列表里选一个。
14
15
  - 图片返回即交付:最终回复只输出工具给的图片行;不评价画质、不描述画面。除非用户明确要求看图,否则不要打开或读取图片。
15
16
  - 只用选择器里的提供商和模型:不要自行切换,也不要用本地生图、建模/Blender、脚本绘图替代。
16
- - 失败时原样报错:可以问用户是否换模型或服务商,但不要自己换、也不要换模型重试。
17
+ - 收到「生图配置不匹配(未提交)」时,用 `mo_image_settings({"refresh":true})` 重读完整配置,纠正参数后只重试一次。仍失败或遇到其他错误时原样报错。沿用用户选定的提供商和模型。
17
18
 
18
- `提示词优化:Off` 时只用下面的调用与输出规则,跳过公式、模板和自检清单,直接把用户原话当 prompt,只做最低限度整理;只有用户明确要求优化时才改写。上下文压缩后看不到配置时用 `refresh: true` 重读。
19
+ 优化开启时只补足粗略需求,保留主体、限制、语言和逐字文本。合适的成稿或用户要求原样的文字直接沿用。配置变化时继续复用上下文里仍适用的写法。优化关闭时使用用户原话,只做最低限度整理;用户明确要求优化时才改写。
19
20
 
20
21
  ## 一、通用公式
21
22
 
@@ -142,6 +143,6 @@ A clean e-commerce hero image for a minimalist skincare serum bottle, centered o
142
143
  ## 六、调用
143
144
 
144
145
  - `prompt`:按当前模型写好的最终提示词;`negative_prompt`:只在当前模型支持时传,不确定就省略。
145
- - 工具参数只有 `prompt`、`negative_prompt`(Auto 再加 `model`),以及 `sizeMode: "auto"` 时的可选 `size`;`sizeOptions` 是可选值,固定尺寸不要传 `size`,质量始终由选择器控制。
146
+ - `sizeMode: "auto"` 时可以设置 `size`。有 `sizeOptions` 时参考候选取值。只有 `qualityMode: "auto"` 时可从 `qualityOptions` 选择 `quality`,固定项以选择器为准。
146
147
  - `strict: true` 时成品尺寸强制等于请求尺寸,不需要自己缩图;结果里的 `generated` 是上游原始尺寸,`original` 是插件留下的原始文件路径。
147
148
  - 工具返回 Markdown 图片行;原样复制到最终回复。