comfy-ts 2.12.0 → 2.13.0

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.
Files changed (69) hide show
  1. package/dist/{LogsSt-U1H0mP1m.js → LogsSt-CUeo843w.js} +18 -4
  2. package/dist/LogsSt-CUeo843w.js.map +1 -0
  3. package/dist/cli.js +4 -4
  4. package/dist/index.cjs +123 -12
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +96 -16
  7. package/dist/index.d.ts +96 -16
  8. package/dist/index.js +123 -12
  9. package/dist/index.js.map +1 -1
  10. package/dist/{run-serve-BeAznay5.js → run-serve-DlRBv_Nk.js} +281 -19
  11. package/dist/run-serve-DlRBv_Nk.js.map +1 -0
  12. package/dist/{run-tui-BTGjvnKk.js → run-tui-B5uxm2_l.js} +4 -4
  13. package/dist/{run-tui-BTGjvnKk.js.map → run-tui-B5uxm2_l.js.map} +1 -1
  14. package/dist/{schemaDrift-Cg39vs53.js → schemaDrift-E95iTF7E.js} +4 -1
  15. package/dist/{schemaDrift-Cg39vs53.js.map → schemaDrift-E95iTF7E.js.map} +1 -1
  16. package/dist/serve-web.js +291 -129
  17. package/dist/{state-C7REnHan.js → state-CUp2J1Zy.js} +122 -14
  18. package/dist/state-CUp2J1Zy.js.map +1 -0
  19. package/dist/web.d.ts +96 -16
  20. package/dist/web.js +123 -12
  21. package/dist/web.js.map +1 -1
  22. package/examples/comfy-cloud/sdk.d.ts +163 -163
  23. package/examples/rvion/10-anima-t2i.cflow.ts +48 -25
  24. package/examples/rvion/11-yue2-t2a.cflow.ts +105 -0
  25. package/examples/rvion/12-stable-audio-3-t2a.cflow.ts +78 -0
  26. package/examples/rvion/13-ace-step-15-xl-t2a.cflow.ts +153 -0
  27. package/examples/rvion/stableAudio3Prompts.ts +19 -0
  28. package/package.json +2 -2
  29. package/src/cli/serve/ServeApp.ts +157 -18
  30. package/src/cli/serve/byteRange.ts +48 -0
  31. package/src/cli/serve/run-serve.ts +12 -3
  32. package/src/cli/serve/web/api.ts +24 -0
  33. package/src/cli/serve/web/components/App.tsx +305 -156
  34. package/src/cli/serve/web/components/DraftTabs.tsx +167 -0
  35. package/src/cli/serve/web/components/Gallery.tsx +44 -19
  36. package/src/cli/serve/web/components/Icon.tsx +40 -0
  37. package/src/cli/serve/web/components/Omnibox.tsx +70 -20
  38. package/src/cli/serve/web/components/SideMenu.tsx +414 -0
  39. package/src/cli/serve/web/components/TooltipLayer.tsx +3 -2
  40. package/src/cli/serve/web/components/VarsForm.tsx +70 -351
  41. package/src/cli/serve/web/components/controls/LorasControl.tsx +24 -22
  42. package/src/cli/serve/web/promptEditor/promptExtensions.ts +6 -3
  43. package/src/cli/serve/web/state/EnhancerSt.ts +17 -2
  44. package/src/cli/serve/web/state/FormSt.ts +22 -2
  45. package/src/cli/serve/web/state/OmniboxSt.ts +3 -1
  46. package/src/cli/serve/web/state/WebSt.ts +172 -33
  47. package/src/cli/serve/web/state/draftNames.ts +16 -0
  48. package/src/cli/serve/web/state/draftTabs.ts +75 -0
  49. package/src/cli/serve/web/state/generateButton.ts +1 -1
  50. package/src/cli/serve/web/state/omnibox.ts +82 -18
  51. package/src/cli/serve/web/state/shortcuts.ts +56 -7
  52. package/src/cli/serve/web/styles.ts +242 -82
  53. package/src/cli/serve/workflowTags.ts +42 -0
  54. package/src/cli/serve/workspaceLabels.ts +23 -0
  55. package/src/cli/tui/state/DraftsSt.ts +10 -6
  56. package/src/coreExports.ts +1 -0
  57. package/src/host/ComfyHost.ts +17 -2
  58. package/src/host/ResilientWebsocket.ts +54 -4
  59. package/src/runner/ComfyExecution.ts +60 -0
  60. package/src/runner/ComfyWorkflow.ts +4 -0
  61. package/src/runner/ComfyWsApi.ts +2 -0
  62. package/src/runner/MediaImage.ts +2 -2
  63. package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +5 -5
  64. package/src/sdk-generator/comfyui-sdk-codegen.ts +1 -1
  65. package/src/utils/copyName.ts +12 -0
  66. package/src/vars/DefinedWorkflow.ts +7 -1
  67. package/dist/LogsSt-U1H0mP1m.js.map +0 -1
  68. package/dist/run-serve-BeAznay5.js.map +0 -1
  69. package/dist/state-C7REnHan.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  // the var rows: each kind dispatches to its matching control (the point of the
2
2
  // web ui — architecture item 12) + the sticky run bar
3
- import { observer, useLocalObservable } from 'mobx-react-lite'
3
+ import { observer } from 'mobx-react-lite'
4
4
  import { useEffect, useRef, type ReactNode } from 'react'
5
5
  import { MOD_KEY } from 'src/cli/serve/web/components/modKey.ts'
6
6
  import { runChipText } from 'src/cli/serve/web/state/stableSlots.ts'
@@ -21,7 +21,7 @@ import { ImageControl } from 'src/cli/serve/web/components/controls/ImageControl
21
21
  import { LorasControl } from 'src/cli/serve/web/components/controls/LorasControl.tsx'
22
22
  import { SeedControl } from 'src/cli/serve/web/components/controls/SeedControl.tsx'
23
23
  import { SizeControl } from 'src/cli/serve/web/components/controls/SizeControl.tsx'
24
- import type { FormSt, VarSt } from 'src/cli/serve/web/state/FormSt.ts'
24
+ import type { VarSt } from 'src/cli/serve/web/state/FormSt.ts'
25
25
  import type { WebSt } from 'src/cli/serve/web/state/WebSt.ts'
26
26
 
27
27
  const VarControl = observer(function VarControl(p: {
@@ -118,6 +118,18 @@ const VarRow = observer(function VarRow(p: {
118
118
  p.st.moveVar({ module: p.module, names: p.names, from, to: p.index })
119
119
  }}
120
120
  >
121
+ {/* in the form's left gutter: back to the workflow's default. Always there (disabled at
122
+ the default), so no row moves when a value changes */}
123
+ <button
124
+ type="button"
125
+ className="var-reset"
126
+ disabled={p.v.isAtDefault}
127
+ data-tip={p.v.isAtDefault ? 'at the workflow default' : 'reset to the workflow default'}
128
+ aria-label="reset to the workflow default"
129
+ onClick={() => p.v.resetToDefault()}
130
+ >
131
+ <Icon name="refresh" size={0.95} />
132
+ </button>
121
133
  {/* the LABEL is the handle: a separate grip was one more piece of permanent chrome
122
134
  for something the label itself can carry */}
123
135
  <div
@@ -199,230 +211,69 @@ function LabelResizer(p: { st: WebSt }): ReactNode {
199
211
  )
200
212
  }
201
213
 
202
- /** `new`, `new 2`, … the first name no draft of this workflow has */
203
- function freeDraftName(drafts: readonly string[]): string {
204
- if (!drafts.includes('new')) return 'new'
205
- let n = 2
206
- while (drafts.includes(`new ${n}`)) n++
207
- return `new ${n}`
208
- }
209
-
210
- /** the draft box: name, autosave state as its legend, and the actions that own this draft.
211
- * new and duplicate ask for the name INLINE, window.prompt is silently suppressed by browsers
212
- * after a few dialogs, which reads exactly like a dead button */
213
- const DraftBox = observer(function DraftBox(p: { st: WebSt; form: FormSt }) {
214
- const local = useLocalObservable(() => ({
215
- /** null = showing the picker; otherwise the pending name and what it will do */
216
- mode: null as null | 'duplicate' | 'rename' | 'new',
217
- name: '',
218
- start(mode: 'duplicate' | 'rename' | 'new', from: string) {
219
- this.mode = mode
220
- this.name = mode === 'duplicate' ? `${from} copy` : from
221
- },
222
- set(v: string) {
223
- this.name = v
224
- },
225
- stop() {
226
- this.mode = null
227
- },
228
- }))
229
- const drafts = p.st.moduleByKey(p.form.moduleKey)?.drafts ?? [p.form.draft]
230
- const confirm = (): void => {
231
- const name = local.name.trim()
232
- const mode = local.mode
233
- local.stop()
234
- if (name === '' || mode == null) return
235
- if (mode === 'duplicate') void p.st.duplicateDraft(name)
236
- else if (mode === 'new') void p.st.newDraft(name)
237
- else void p.st.renameDraft(name)
238
- }
214
+ /** everything about running on ONE row: Run with its stop square beside it (red while a run is
215
+ * in progress, grey otherwise), then the two buttons that clear something, each carrying the
216
+ * count it acts on. Every part is always there (disabled when it has nothing to act on), and
217
+ * the counts have tabular digits, so the row never shifts */
218
+ export const GenerateButton = observer(function GenerateButton(p: { st: WebSt }) {
219
+ const run = p.st.run
220
+ // the text never changes, so the button never changes size: the progress is a fill sweeping
221
+ // across it, the exact percent is on the running card
222
+ const look = generateButtonLook({ isRunning: run.isRunning, percent: run.progressPercent })
223
+ const pending = runChipText({ kind: 'queue', count: run.pendingCount }).count
224
+ const images = runChipText({ kind: 'results', count: run.results.length }).count
239
225
  return (
240
- <div className="head-box">
241
- <span className="head-label">
242
- draft
243
- <span className={p.form.saveState === 'error' ? 'save-state error' : 'save-state'}>
244
- {p.form.saveState === 'saving' ? '· saving' : null}
245
- {p.form.saveState === 'saved' ? '· saved' : null}
246
- {p.form.saveState === 'error' ? '· NOT SAVED' : null}
247
- </span>
248
- </span>
249
- {local.mode != null ? (
250
- <input
251
- type="text"
252
- autoFocus
253
- className="head-input"
254
- value={local.name}
255
- // enter is the ONLY commit now, so it has to be said
256
- placeholder={
257
- local.mode === 'rename'
258
- ? 'new name, then enter'
259
- : local.mode === 'new'
260
- ? 'name of the new draft (workflow defaults), then enter'
261
- : 'new draft name, then enter'
226
+ <span className="run-bar">
227
+ <span className="btn-group run-split">
228
+ <button
229
+ type="button"
230
+ className={look.running ? 'primary running' : 'primary'}
231
+ data-tip={
232
+ look.running
233
+ ? `running ${look.fill ?? 0}%: click again to queue another (⌘⏎ / ctrl+⏎)`
234
+ : '⌘⏎ / ctrl+⏎: click again to queue another'
262
235
  }
263
- onFocus={(e) => e.currentTarget.select()}
264
- onChange={(e) => local.set(e.target.value)}
265
- onKeyDown={(e) => {
266
- if (e.key === 'Enter') confirm()
267
- if (e.key === 'Escape') local.stop()
268
- }}
269
- // blur CANCELS, it does not commit: picking another draft blurs this input, and a
270
- // rename committed on blur raced that selection, renameDraft bails when the form
271
- // has already moved on, leaving a duplicate instead of a rename, silently. enter
272
- // commits, which is the only unambiguous signal
273
- onBlur={() => local.stop()}
274
- />
275
- ) : (
276
- /* the name IS the picker: every draft of this workflow, switching selects it. Rename
277
- sits before it and delete after it: the two actions ON this name, around it */
278
- <span className="head-line draft-line">
279
- <button
280
- type="button"
281
- className="head-icon"
282
- data-tip="rename this draft (the file is renamed)"
283
- onClick={() => local.start('rename', p.form.draft)}
284
- >
285
- <Icon name="pen" />
286
- </button>
287
- <select
288
- className="head-select draft"
289
- value={p.form.draft}
290
- data-tip="switch draft"
291
- onChange={(e) => void p.st.select({ module: p.form.moduleKey, draft: e.target.value })}
292
- >
293
- {drafts.map((d) => (
294
- <option key={d} value={d}>
295
- {d}
296
- </option>
297
- ))}
298
- </select>
299
- <button
300
- type="button"
301
- className="head-icon danger"
302
- data-tip="delete this draft's file (default resets to the workflow's own values)"
303
- onClick={() => {
304
- if (window.confirm(`delete draft '${p.form.draft}' of ${p.form.moduleKey}? the file is removed.`))
305
- void p.st.deleteDraft({ module: p.form.moduleKey, draft: p.form.draft })
306
- }}
307
- >
308
- <Icon name="trash" />
309
- </button>
310
- </span>
311
- )}
312
- <span className="head-line">
313
- {/* the two ways to MAKE a draft, side by side: from the workflow's defaults, or from
314
- what is on screen */}
315
- <span className="btn-group">
316
- <button
317
- type="button"
318
- className="accent"
319
- data-tip="new draft with the workflow's own default values"
320
- onClick={() => (local.mode != null ? confirm() : local.start('new', freeDraftName(drafts)))}
321
- >
322
- <Icon name="plus" /> new
323
- </button>
324
- <button
325
- type="button"
326
- className="accent"
327
- data-tip="save these values as a new draft"
328
- onClick={() => (local.mode != null ? confirm() : local.start('duplicate', p.form.draft))}
329
- >
330
- <Icon name="copy-plus" /> copy
331
- </button>
332
- </span>
333
- {/* FAR RIGHT of the same line, outside the group: inside it, the broom appeared and
334
- vanished with the dirty count and shoved the other buttons sideways */}
335
- {p.form.dirtyCount > 0 ? (
336
- <button
337
- type="button"
338
- className="dirty head-right"
339
- data-tip={`${p.form.dirtyCount} var${p.form.dirtyCount > 1 ? 's' : ''} changed this session — revert to the values this draft loaded with`}
340
- onClick={() => p.form.revertAll()}
341
- >
342
- <Icon name="broom" />
343
- </button>
344
- ) : null}
236
+ style={
237
+ look.fill == null
238
+ ? undefined
239
+ : {
240
+ background: `linear-gradient(90deg, var(--accent) ${look.fill}%, var(--accent-dim) ${look.fill}%)`,
241
+ }
242
+ }
243
+ onClick={() => p.st.generate()}
244
+ >
245
+ <Icon name="play" size={0.85} /> {look.label}
246
+ {/* the shortcut is SAID, not only tooltipped: nobody hovers a button they can click */}
247
+ <span className="kbd-hint">{MOD_KEY}⏎</span>
248
+ </button>
249
+ <button
250
+ type="button"
251
+ className={run.isRunning ? 'run-stop live' : 'run-stop'}
252
+ disabled={!run.isRunning}
253
+ data-tip="stop the run in progress (the queue behind it stays)"
254
+ onClick={() => void p.st.hostAction('interrupt')}
255
+ >
256
+ <Icon name="stop" />
257
+ </button>
345
258
  </span>
346
- </div>
347
- )
348
- })
349
-
350
- function RunChip(p: {
351
- kind: 'queue' | 'results'
352
- count: number
353
- tip: string
354
- clearTip: string
355
- canClear: boolean
356
- onClear(): void
357
- }): ReactNode {
358
- const t = runChipText({ kind: p.kind, count: p.count })
359
- // an icon and a count, the word in the tooltip: the results panel can be narrow
360
- return (
361
- <span className={p.count > 0 ? 'run-chip' : 'run-chip empty'} data-tip={`${t.label}: ${p.tip}`}>
362
- <Icon name={p.kind === 'queue' ? 'rows' : 'image'} size={0.95} />
363
- <span className="run-chip-count">{t.count}</span>
364
259
  <button
365
260
  type="button"
366
- className="run-chip-clear"
367
- data-tip={p.clearTip}
368
- aria-label={`clear the ${t.label}`}
369
- disabled={!p.canClear}
370
- onClick={() => p.onClear()}
261
+ className="run-end"
262
+ disabled={run.pendingCount === 0}
263
+ data-tip={`drop the ${run.pendingCount} prompt(s) not yet sent to the host`}
264
+ onClick={() => run.clearQueue()}
371
265
  >
372
- <Icon name="close" size={0.8} />
266
+ <Icon name="close" /> Clear <b className="run-num">{pending}</b> queue
373
267
  </button>
374
- </span>
375
- )
376
- }
377
-
378
- /** everything about running on one line: the button, what is queued behind it, what it has
379
- * produced. a count and one clear is the whole decision a queue offers */
380
- export const GenerateButton = observer(function GenerateButton(p: { st: WebSt }) {
381
- const run = p.st.run
382
- // the text never changes, so the button never changes size: the progress is a fill sweeping
383
- // across it, the exact percent is on the running card
384
- const look = generateButtonLook({ isRunning: run.isRunning, percent: run.progressPercent })
385
- return (
386
- <span className="run-line">
387
268
  <button
388
269
  type="button"
389
- className={look.running ? 'primary running' : 'primary'}
390
- data-tip={
391
- look.running
392
- ? `running ${look.fill ?? 0}%: click again to queue another (⌘⏎ / ctrl+⏎)`
393
- : '⌘⏎ / ctrl+⏎: click again to queue another'
394
- }
395
- style={
396
- look.fill == null
397
- ? undefined
398
- : {
399
- background: `linear-gradient(90deg, var(--accent) ${look.fill}%, var(--accent-dim) ${look.fill}%)`,
400
- }
401
- }
402
- onClick={() => p.st.generate()}
270
+ className="run-end"
271
+ disabled={run.results.length === 0}
272
+ data-tip="forget every image shown here (saved files stay on disk)"
273
+ onClick={() => run.clear()}
403
274
  >
404
- <Icon name="play" size={0.85} /> {look.label}
405
- {/* the shortcut is SAID, not only tooltipped: nobody hovers a button they can click */}
406
- <span className="kbd-hint">{MOD_KEY}⏎</span>
275
+ <Icon name="trash" /> Erase <b className="run-num">{images}</b> img
407
276
  </button>
408
- {/* both chips are ALWAYS here at one width: a chip appearing, or a count growing a
409
- digit, moved everything beside it. An empty one is dimmed, its clear disabled */}
410
- <RunChip
411
- kind="queue"
412
- count={run.queue.length}
413
- tip="prompts waiting behind this one"
414
- clearTip={`drop the ${run.pendingCount} not yet sent to the host`}
415
- canClear={run.pendingCount > 0}
416
- onClear={() => run.clearQueue()}
417
- />
418
- <RunChip
419
- kind="results"
420
- count={run.results.length}
421
- tip="runs kept in this page"
422
- clearTip="forget every run shown here"
423
- canClear={run.results.length > 0}
424
- onClear={() => run.clear()}
425
- />
426
277
  </span>
427
278
  )
428
279
  })
@@ -481,11 +332,14 @@ export const VarsForm = observer(function VarsForm(p: { st: WebSt }) {
481
332
  return
482
333
  }
483
334
  const s = shortcutOf(e)
484
- if (s == null) return
335
+ // the menu is page layout: App owns that key
336
+ if (s == null || s === 'toggle-menu') return
485
337
  // the jumps land in the form, which the enhancer covers: only the blur still makes sense
486
338
  if (p.st.enhancer.isOpen && s !== 'toggle-blur') return
487
339
  e.preventDefault()
488
340
  if (s === 'toggle-blur') return p.st.toggleBlur()
341
+ if (s === 'duplicate-draft') return void p.st.duplicateCurrentDraft()
342
+ if (s === 'rename-draft') return p.st.startRename()
489
343
  if (s === 'open-enhancer') {
490
344
  const f = p.st.form
491
345
  const v = f?.vars.find((x) => x.name === targetsRef.current.prompt)
@@ -519,141 +373,6 @@ export const VarsForm = observer(function VarsForm(p: { st: WebSt }) {
519
373
  : null
520
374
  return (
521
375
  <div>
522
- {/* the TUI header, on the web: labelled boxes for what you are editing and where it runs.
523
- head-shell is the QUERY CONTAINER: the boxes size themselves against the form
524
- column, which the results placement widens and narrows, not against the window */}
525
- <div className="head-shell">
526
- <div className="head-boxes">
527
- {/* the workflow name IS the way into the omnibox, and so is ⌘K / ⌘J */}
528
- <div className="head-box">
529
- <span className="head-label">workflow</span>
530
- <div className="head-line">
531
- <button
532
- type="button"
533
- className="head-value app as-link"
534
- data-tip="search every workflow and draft (⌘K or ⌘J)"
535
- onClick={() => p.st.omnibox.open()}
536
- >
537
- {form.moduleKey}
538
- </button>
539
- </div>
540
- <div className="head-line">
541
- <span className="btn-group">
542
- <button
543
- type="button"
544
- data-tip="search every workflow and draft (⌘K or ⌘J)"
545
- onClick={() => p.st.omnibox.open()}
546
- >
547
- <Icon name="search" /> search <span className="kbd-hint">{MOD_KEY}K</span>
548
- </button>
549
- </span>
550
- {Object.keys(p.st.loadErrors).length > 0 ? (
551
- <button
552
- type="button"
553
- className="link load-errors"
554
- data-tip="some workflows failed to load: the list is at the bottom of the search"
555
- onClick={() => p.st.omnibox.open()}
556
- >
557
- <Icon name="warn" /> {Object.keys(p.st.loadErrors).length} failed
558
- </button>
559
- ) : null}
560
- </div>
561
- </div>
562
- {/* duplicate and delete act on THIS draft, so they live in the draft box */}
563
- <DraftBox st={p.st} form={form} />
564
- <div className="head-box">
565
- {/* a restart shows HERE, as the card's legend like the draft's `· saving`: a line
566
- under the cards moved the whole form and read as unrelated to the host */}
567
- <span className="head-label">
568
- host
569
- {p.st.hostWatch === 'down' ? <span className="save-state pulse">· restarting…</span> : null}
570
- {p.st.hostWatch === 'back' ? <span className="save-state">· back up</span> : null}
571
- </span>
572
- {/* the box itself, like the draft: its name, with the two actions ON the box
573
- around it. The ones on the RUNNING work sit on the line below, in words */}
574
- <div className="head-line draft-line">
575
- {/* the ONE refresh: models, nodes and the lora list. It also runs by itself when
576
- the host changes, pulsing while it works */}
577
- <button
578
- type="button"
579
- className={p.st.refreshing ? 'head-icon pulse' : 'head-icon'}
580
- data-tip={
581
- p.st.refreshing
582
- ? 'refreshing what the host has…'
583
- : 'refresh what the host has (models, nodes, loras). It also refreshes by itself when something new appears'
584
- }
585
- onClick={() => void p.st.refreshHost()}
586
- >
587
- <Icon name="refresh" />
588
- </button>
589
- {/* pick where this workflow RUNS (the TUI's host override), remembered per module */}
590
- {p.st.hosts.hosts.length > 1 ? (
591
- <select
592
- className="head-select"
593
- value={p.st.hostFor(form.moduleKey)}
594
- data-tip="run this workflow on another host"
595
- onChange={(e) => void p.st.setModuleHost({ module: form.moduleKey, host: e.target.value })}
596
- >
597
- {p.st.hosts.hosts.map((h) => (
598
- <option key={h.id} value={h.id}>
599
- {h.id === (p.st.hosts.defaults[form.moduleKey] ?? '') ? `${h.id} (its own)` : h.id}
600
- </option>
601
- ))}
602
- </select>
603
- ) : (
604
- <span className="head-value host">{p.st.hostFor(form.moduleKey) || form.host}</span>
605
- )}
606
- <button
607
- type="button"
608
- className="head-icon danger"
609
- data-tip="restart ComfyUI on that host (manager reboot) — it reconnects when back"
610
- onClick={() => {
611
- if (window.confirm(`restart ComfyUI on '${p.st.hostFor(form.moduleKey)}'?`))
612
- void p.st.hostAction('restart')
613
- }}
614
- >
615
- <Icon name="power" />
616
- </button>
617
- </div>
618
- <div className="head-line">
619
- {/* two separate buttons: stopping the run and emptying the queue are different
620
- decisions, and the destructive one wears its warning color */}
621
- <span className="btn-group">
622
- <button
623
- type="button"
624
- data-tip="interrupt the prompt running now"
625
- onClick={() => void p.st.hostAction('interrupt')}
626
- >
627
- <Icon name="pause" /> stop
628
- </button>
629
- </span>
630
- <span className="btn-group">
631
- <button
632
- type="button"
633
- className="quiet-danger"
634
- data-tip="drop everything still pending in the host queue"
635
- onClick={() => void p.st.hostAction('clear-queue')}
636
- >
637
- <Icon name="trash" /> clear queue
638
- </button>
639
- </span>
640
- {p.st.isHostOverridden(form.moduleKey) ? (
641
- <button
642
- type="button"
643
- className="link"
644
- data-tip={`runs on an override — back to ${p.st.hosts.defaults[form.moduleKey] ?? 'its own host'}`}
645
- onClick={() => void p.st.setModuleHost({ module: form.moduleKey, host: null })}
646
- >
647
- <Icon name="swap" /> reset
648
- </button>
649
- ) : null}
650
- </div>
651
- </div>
652
- </div>
653
- </div>
654
- {/* a host action that FAILS says so on its own line; one that works says nothing here,
655
- the ↻ pulse and the host card's legend show what runs */}
656
- {p.st.hostError != null ? <div className="error">🔴 {p.st.hostError}</div> : null}
657
376
  {/* the autosave state is the draft box's legend now; only a FAILURE gets a line of
658
377
  its own, because that one you must not miss */}
659
378
  {form.saveState === 'error' ? <div className="error">🔴 draft save failed: {form.saveError}</div> : null}
@@ -459,11 +459,12 @@ export const LorasControl = observer(function LorasControl(p: {
459
459
  filterRef.current?.select()
460
460
  }
461
461
 
462
- // ONE size factor for every lora image (the slider): the palette card, its image, and the
463
- // popup's grid all follow it. 168/130 and 120/110 are the base card and image sizes
464
- const scale = p.st.loraScale
465
- const cardWidth = Math.round(168 * scale)
466
- const gridMin = Math.round(120 * scale)
462
+ // two size factors, each with its own slider: the form's cards follow formScale, the
463
+ // popup's grid follows popupScale. 168/130 and 120/110 are the base card and image sizes
464
+ const formScale = p.st.loraFormScale
465
+ const popupScale = p.st.loraPopupScale
466
+ const cardWidth = Math.round(168 * formScale)
467
+ const gridMin = Math.round(120 * popupScale)
467
468
  const thumb = (name: string, height?: number): ReactNode => {
468
469
  if (!showImages) return null
469
470
  const style = height == null ? undefined : { height }
@@ -491,19 +492,20 @@ export const LorasControl = observer(function LorasControl(p: {
491
492
  </span>
492
493
  )
493
494
 
494
- /** the image size, a small slider: only while images are shown */
495
- const sizeSlider = showImages ? (
496
- <input
497
- type="range"
498
- className="setting-range"
499
- min={0.6}
500
- max={2}
501
- step={0.05}
502
- value={scale}
503
- data-tip={`lora image size ×${scale.toFixed(2)}`}
504
- onChange={(e) => p.st.setLoraScale(parseFloat(e.target.value))}
505
- />
506
- ) : null
495
+ /** an image size, a small slider: only while images are shown */
496
+ const sizeSlider = (where: string, scale: number, set: (v: number) => void): ReactNode =>
497
+ showImages ? (
498
+ <input
499
+ type="range"
500
+ className="setting-range"
501
+ min={0.6}
502
+ max={2}
503
+ step={0.05}
504
+ value={scale}
505
+ data-tip={`lora image size in the ${where} ×${scale.toFixed(2)}`}
506
+ onChange={(e) => set(parseFloat(e.target.value))}
507
+ />
508
+ ) : null
507
509
 
508
510
  const visibilityToggles = (
509
511
  <>
@@ -577,7 +579,7 @@ export const LorasControl = observer(function LorasControl(p: {
577
579
  <label className="menu-item menu-range">
578
580
  <span className="menu-check" />
579
581
  size
580
- {sizeSlider}
582
+ {sizeSlider('form', formScale, (v) => p.st.setLoraFormScale(v))}
581
583
  </label>
582
584
  ) : null}
583
585
  <div className="menu-sep" />
@@ -735,7 +737,7 @@ export const LorasControl = observer(function LorasControl(p: {
735
737
  data-tip={`${name}\nclick to ${isOn(sec, name) ? 'pause' : 'resume'}, click the title for details`}
736
738
  onClick={() => toggleOn(sec, name, !isOn(sec, name))}
737
739
  >
738
- {thumb(name, Math.round(130 * scale))}
740
+ {thumb(name, Math.round(130 * formScale))}
739
741
  {showImages && !isOn(sec, name) ? pausedMark : null}
740
742
  </button>
741
743
  <button
@@ -836,7 +838,7 @@ export const LorasControl = observer(function LorasControl(p: {
836
838
  {/* the display toggles first, the search in the middle, close alone at the end */}
837
839
  <div className="modal-head">
838
840
  <span className="btn-group">{visibilityToggles}</span>
839
- {sizeSlider}
841
+ {sizeSlider('popup', popupScale, (v) => p.st.setLoraPopupScale(v))}
840
842
  <input
841
843
  ref={filterRef}
842
844
  type="text"
@@ -961,7 +963,7 @@ export const LorasControl = observer(function LorasControl(p: {
961
963
  }}
962
964
  >
963
965
  <span className="thumb-box">
964
- {thumb(name, Math.round(110 * scale))}
966
+ {thumb(name, Math.round(110 * popupScale))}
965
967
  {showImages && picked && !on ? pausedMark : null}
966
968
  </span>
967
969
  <div className="lora-label">
@@ -153,8 +153,11 @@ function applyTag(insert: string): Completion['apply'] {
153
153
  }
154
154
  }
155
155
 
156
- /** the options for one search text: lora words containing it, then the tag list's hits */
157
- async function optionsFor(c: PromptEditorCtx, text: string, signal: AbortSignal): Promise<Completion[]> {
156
+ /** the options for one search text: lora words containing it, then the tag list's hits. Only
157
+ * for a prompt that declares a tag list (v.prompt(…, { tags })): completion is opt in per
158
+ * workflow, the loras words included */
159
+ export async function optionsFor(c: PromptEditorCtx, text: string, signal: AbortSignal): Promise<Completion[]> {
160
+ if (c.tags == null) return []
158
161
  const q = text.trim().toLowerCase()
159
162
  const options: Completion[] = []
160
163
  const seenWords = new Set<string>()
@@ -164,7 +167,7 @@ async function optionsFor(c: PromptEditorCtx, text: string, signal: AbortSignal)
164
167
  seenWords.add(lower)
165
168
  options.push({ label: w.word, detail: w.source, type: 'lora', boost: 50, apply: applyTag(w.word) })
166
169
  }
167
- if (c.tags == null || q === '') return options
170
+ if (q === '') return options
168
171
  const hits = await c.searchTags(text.trim(), signal)
169
172
  c.onTagError(null)
170
173
  hits.forEach((h, ix) => {
@@ -7,6 +7,7 @@
7
7
  // normalizeSettings/nextPresetName are PURE and headless-tested.
8
8
  import { makeAutoObservable, reaction, runInAction, type IReactionDisposer } from 'mobx'
9
9
  import { stringMap } from 'src/utils/stringMap.ts'
10
+ import { copyName } from 'src/utils/copyName.ts'
10
11
  import {
11
12
  deleteLlmConfig,
12
13
  deletePromptEnhancer,
@@ -405,7 +406,14 @@ export class EnhancerSt {
405
406
 
406
407
  duplicateConfig(): void {
407
408
  const c = this.configEntry
408
- if (c != null) this.addConfig(`${c.name} copy`, c.config)
409
+ if (c != null)
410
+ this.addConfig(
411
+ copyName(
412
+ c.name,
413
+ this.configs.map((x) => x.name),
414
+ ),
415
+ c.config,
416
+ )
409
417
  }
410
418
 
411
419
  /** rename = write the new file, delete the old one (the filename IS the identity) */
@@ -568,7 +576,14 @@ export class EnhancerSt {
568
576
 
569
577
  duplicatePreset(): void {
570
578
  const p = this.preset
571
- if (p != null) this.addPreset(`${p.name} copy`, p.text)
579
+ if (p != null)
580
+ this.addPreset(
581
+ copyName(
582
+ p.name,
583
+ this.presets.map((x) => x.name),
584
+ ),
585
+ p.text,
586
+ )
572
587
  }
573
588
 
574
589
  /** rename = write the new file, delete the old one (the filename IS the identity) */