diff --git a/calliope-web/src/lib/api.ts b/calliope-web/src/lib/api.ts index 6f1706f1..5692a604 100644 --- a/calliope-web/src/lib/api.ts +++ b/calliope-web/src/lib/api.ts @@ -140,6 +140,11 @@ import type { WorkflowOutputMapEntry, WorkflowConnectionCheck, WorkflowLastTest, + WorkflowMeta, + WorkflowUIFileInput, + WorkflowConvertFileReport, + WorkflowConvertReport, + WorkflowImportResult, } from "./comfy/types"; export type { Job, @@ -154,6 +159,11 @@ export type { WorkflowOutputMapEntry, WorkflowConnectionCheck, WorkflowLastTest, + WorkflowMeta, + WorkflowUIFileInput, + WorkflowConvertFileReport, + WorkflowConvertReport, + WorkflowImportResult, }; async function api(path: string, init?: RequestInit): Promise { @@ -462,6 +472,50 @@ export const comfy = { export const workflows = { list: () => api("/api/workflows"), + /** HEL-682: metadata-only list — 150+ rows without any workflow_json. */ + listMeta: () => api("/api/workflows?view=meta"), + /** HEL-682: dry-run UI→API conversion for a batch of files (nothing stored). */ + convert: ( + files: WorkflowUIFileInput[], + opts?: { endpoint_id?: string | null; refresh?: boolean }, + ) => + api("/api/workflows/convert", { + method: "POST", + body: JSON.stringify({ + files, + ...(opts?.endpoint_id ? { endpoint_id: opts.endpoint_id } : {}), + ...(opts?.refresh ? { refresh: opts.refresh } : {}), + }), + }), + /** HEL-682: commit a batch import (converts server-side, conflicts skipped). */ + importBatch: (files: WorkflowUIFileInput[]) => + api("/api/workflows/import-batch", { + method: "POST", + body: JSON.stringify({ files }), + }), + /** HEL-682: scan a server-side directory of UI-format JSONs — dry-run report. */ + importScanDry: (root: string) => + api("/api/workflows/import-scan", { + method: "POST", + body: JSON.stringify({ root, dry_run: true }), + }), + /** HEL-682: scan a server-side directory of UI-format JSONs — commit the import. */ + importScanCommit: (root: string) => + api("/api/workflows/import-scan", { + method: "POST", + body: JSON.stringify({ root, dry_run: false }), + }), + /** HEL-682: record a use (最近使用). */ + touch: (id: number) => + api<{ ok: boolean }>(`/api/workflows/${id}/touch`, { method: "POST" }), + /** HEL-682: delete byte-identical duplicates, keeping the lowest id. */ + dedupe: () => + api<{ + ok: boolean; + removed: number; + kept_ids: number[]; + removed_ids: number[]; + }>("/api/workflows/dedupe", { method: "POST" }), analyze: ( workflow_json: Record, endpoint_id?: string | null, @@ -537,6 +591,10 @@ export const workflows = { input_schema: ComfyDynamicInput[]; output_map: WorkflowOutputMapEntry[]; output_map_source: "auto" | "user"; + favorite: boolean; + tags: string[]; + category: string; + model_family: string; }>, ) => api(`/api/workflows/${id}`, { diff --git a/calliope-web/src/lib/comfy/types.ts b/calliope-web/src/lib/comfy/types.ts index 10a2c155..2a28fa17 100644 --- a/calliope-web/src/lib/comfy/types.ts +++ b/calliope-web/src/lib/comfy/types.ts @@ -175,6 +175,120 @@ export interface Workflow { last_test?: WorkflowLastTest | null; } +/** + * HEL-682: metadata-only row (GET /api/workflows?view=meta) — the whole + * point is browsing 150+ workflows without downloading workflow_json. + */ +export interface WorkflowMediaIO { + in: string[]; + out: string[]; +} + +export interface WorkflowMeta { + id: number; + name: string; + kind: 'image' | 'video'; + usage: WorkflowUsage | null; + usage_source: 'auto' | 'user' | null; + is_enabled: boolean; + category: string | null; + model_family: string | null; + media_io: WorkflowMediaIO; + tags: string[]; + favorite: boolean; + last_used_at: string | null; + description: string | null; + source: string | null; + source_path: string | null; + prompt_profile: string; + created_at: string; + endpoint_id: string | null; + output_map_source: 'auto' | 'user' | null; + /** Cheap pending check: usage or output mapping not settled yet. */ + needs_mapping: boolean; +} + +/** One UI-format file submitted to the batch convert/import pipeline. */ +export interface WorkflowUIFileInput { + name?: string; + source_path?: string; + workflow_json: Record; + usage?: WorkflowUsage; + description?: string; + tags?: string[]; +} + +export interface WorkflowConvertIssue { + node_id: string; + code: string; + level: 'error' | 'warning'; + message: string; +} + +export interface WorkflowConvertSuggested { + kind: 'image' | 'video'; + usage: WorkflowUsage | null; + usage_ambiguous: boolean; + category: string | null; + category_label: string | null; + model_family: string | null; + media_in: string[]; + media_out: string[]; + description: string | null; +} + +export interface WorkflowPreflightFinding { + level: string; + code: string; + node_id?: string; + node_title?: string; + message: string; + hint?: string; +} + +export interface WorkflowConvertFileReport { + name: string; + source_path: string | null; + status: 'ok' | 'warn' | 'fail'; + needs_confirmation: boolean; + issues: WorkflowConvertIssue[]; + importable: boolean; + skip_reason?: string | null; + suggested?: WorkflowConvertSuggested; + preflight?: { + endpoint_id: string | null; + ok: boolean; + findings: WorkflowPreflightFinding[]; + }; +} + +/** Dry-run report (POST /convert, POST /import-scan with dry_run). */ +export interface WorkflowConvertReport { + total: number; + ok: number; + warn: number; + fail: number; + needs_confirmation: number; + importable: number; + files: WorkflowConvertFileReport[]; +} + +export interface WorkflowImportFileReport extends WorkflowConvertFileReport { + result?: 'imported' | 'skipped' | 'failed'; + id?: number; + existing_id?: number; +} + +/** Commit result (POST /import-batch, POST /import-scan without dry_run). */ +export interface WorkflowImportResult { + total: number; + imported: number; + skipped: number; + imported_ids: number[]; + skipped_files: { name: string; source_path: string | null; reason: string | null }[]; + files: WorkflowImportFileReport[]; +} + export interface Job { id: number; project_id: number; diff --git a/calliope-web/src/lib/components/ui/icons.ts b/calliope-web/src/lib/components/ui/icons.ts index ffa682ed..59260404 100644 --- a/calliope-web/src/lib/components/ui/icons.ts +++ b/calliope-web/src/lib/components/ui/icons.ts @@ -51,6 +51,7 @@ export const icons = { stop: '', // Status check: '', + star: '', alert: '', info: '', diff --git a/calliope-web/src/lib/components/workflows/WorkflowBatchImportWizard.svelte b/calliope-web/src/lib/components/workflows/WorkflowBatchImportWizard.svelte new file mode 100644 index 00000000..c5d3c5a8 --- /dev/null +++ b/calliope-web/src/lib/components/workflows/WorkflowBatchImportWizard.svelte @@ -0,0 +1,908 @@ + + + +
    +
  1. + 1{t('wiz.stepSource')} +
  2. +
  3. + 2{t('wiz.stepReport')} +
  4. +
  5. + 3{t('wiz.stepResult')} +
  6. +
+ + {#if error} + + {/if} + + {#if step === 'source'} +
+ + +
+ + {#if mode === 'scan'} + + {:else} +
+ {t('wiz.pickFiles')} + + void readPickedFiles(e.currentTarget.files)} + /> + {t('wiz.pickFilesHint')} + {#if reading} +

{t('common.loading')}…

+ {/if} + {#if inputFiles.length} +

+ + {t('wiz.parsed', { n: inputFiles.length })} +

+ {/if} + {#if nonUiSkipped.length} +

+ + {t('wiz.notUi', { n: nonUiSkipped.length })} +

+ {/if} +
+ {/if} + + {#if mode === 'files' && endpoints.length > 0} + + {/if} + {:else if step === 'report' && report} +
+ {t('wiz.total', { n: report.total })} + {t('wiz.ok', { n: report.ok })} + {t('wiz.warn', { n: report.warn })} + {t('wiz.fail', { n: report.fail })} + {t('wiz.confirmCount', { n: report.needs_confirmation })} + {t('wiz.importable', { n: report.importable })} +
+

{t('wiz.reportHint')}

+ +
+
+ + + +
+ (rSearch = e.currentTarget.value)} + placeholder={t('wiz.searchPh')} + aria-label={t('wiz.searchPh')} + /> +
+ +
+ {#each filteredFiles.slice(0, visible) as f (rk(f))} +
+ {#if mode === 'files'} + { + const next = new Set(excludedKeys); + if (e.currentTarget.checked) next.delete(rk(f)); + else next.add(rk(f)); + excludedKeys = next; + }} + /> + {/if} + +
+
+ {f.name} + {#if f.suggested?.model_family} + {f.suggested.model_family} + {/if} + {#if f.suggested} + {usageLabel(f.suggested.usage)} + + {/if} + {#if f.status === 'warn'} + {t('wiz.warnTag')} + {/if} + {#if f.needs_confirmation} + {t('wiz.confirmTag')} + {/if} + {#if f.preflight && !f.preflight.ok} + x.message).join('\n')}> + {t('wiz.preflightTag')} + + {/if} +
+ {#if f.source_path} +
{f.source_path}
+ {/if} + {#if !f.importable && f.skip_reason} +
{t('wiz.skipReason', { reason: skipText(f.skip_reason) })}
+ {/if} + {#if needsUsagePick(f)} + + {/if} + {#if f.issues.length} + + {#if expandedIssues.has(rk(f))} +
    + {#each f.issues as iss, i (`${rk(f)}#${i}`)} +
  • + {iss.node_id} + {iss.message} +
  • + {/each} +
+ {/if} + {/if} +
+
+ {/each} +
+ {#if filteredFiles.length > visible} + + {/if} + {:else if step === 'result' && result} +
+ {t('wiz.imported', { n: result.imported })} + {t('wiz.skipped', { n: result.skipped })} + {#if result.files.some((f) => f.result === 'failed')} + {t('wiz.fail', { n: result.files.filter((f) => f.result === 'failed').length })} + {/if} +
+

{t('wiz.resultNote')}

+ {#if usageApplied > 0} +

{t('wiz.usageApplied', { n: usageApplied })}

+ {/if} +
+ {#each result.files as f (rk(f))} +
+ +
+
+ {f.name} + {#if f.result === 'imported'} + + + {t('wiz.importedTag', { id: f.id ?? '?' })} + + {:else if f.skip_reason === 'conflict' || f.result === 'skipped'} + {skipText(f.skip_reason)} + {:else} + {skipText(f.skip_reason)} + {/if} +
+ {#if f.source_path} +
{f.source_path}
+ {/if} +
+
+ {/each} +
+ {/if} + + {#snippet footer()} + {#if step === 'source'} + + + {:else if step === 'report'} + + {t('wiz.selectedN', { n: selectedCount })} + {#if blockedCount}· {t('wiz.excludedM', { m: blockedCount })}{/if} + + + + {:else} + + + {/if} + {/snippet} +
+ + diff --git a/calliope-web/src/lib/components/workflows/WorkflowLibrary.svelte b/calliope-web/src/lib/components/workflows/WorkflowLibrary.svelte new file mode 100644 index 00000000..efcec6d4 --- /dev/null +++ b/calliope-web/src/lib/components/workflows/WorkflowLibrary.svelte @@ -0,0 +1,1343 @@ + + + + +
+
+

{t('conn.wfTitle')}

+ {t('wl.hint')} + + + + + +
+ + {#if rows.length === 0} + +

{t('conn.missingMaterial')}

+ {:else} +

+ {t('conn.wfCount', { + n: rows.length, + m: rows.filter((r) => r.kind === 'image').length, + k: rows.filter((r) => r.kind === 'video').length, + })} + {#if pendingCount} + · {t('conn.wfPendingCount', { n: pendingCount })} + {/if} + {#if favCount} + · {t('wl.favCount', { n: favCount })} + {/if} +

+ +
+
+ + (search = e.currentTarget.value)} + placeholder={t('wl.searchPh')} + aria-label={t('wl.searchPh')} + /> + / +
+
+ + + + + + +
+
+ + + + + {#if hasActiveFilter} + + {/if} +
+
+ + {#if filtered.length === 0} + + {:else} +

{t('wl.resultCount', { n: filtered.length, m: rows.length })}

+ + {#if selected.size > 0} + + {/if} + +
+ toggleSelectVisible()} + /> + {t('common.name')} + {t('wl.headMeta')} + {t('wl.headActions')} +
+ +
+ {#each visible as row (row.id)} + {@const full = fullCache[row.id]} +
+ toggleRow(row.id, e.currentTarget.checked)} + /> + + + + + + {#if row.category} + {categoryLabel(row.category)} + {/if} + {#if row.model_family} + {row.model_family} + {/if} + {#if (row.media_io?.in ?? []).length || (row.media_io?.out ?? []).length} + + {/if} + {#if row.usage} + + {usageLabel(row.usage)} + + {:else} + + {/if} + {#if rowNeedsOutputMap(row)} + + {/if} + {#if !row.is_enabled && row.usage && !rowNeedsOutputMap(row)} + {t('conn.wfDisabledBadge')} + {/if} + {#if full && (full.warnings ?? []).some((w) => w.level === 'error')} + w.level === 'error').map((w) => w.message).join('\n')}> + {t('conn.wfBrokenBadge')} + + {/if} + + + { + if (next) void workflows.update(row.id, { is_enabled: true }).then( + () => client.invalidateQueries({ queryKey: ['workflows'] }), + (err) => toast.error(apiErrorMessage(err)), + ); + else void workflows.update(row.id, { is_enabled: false }).then( + () => client.invalidateQueries({ queryKey: ['workflows'] }), + (err) => toast.error(apiErrorMessage(err)), + ); + }} + /> + {#if !row.usage || rowNeedsOutputMap(row)} + ? + {/if} + + + + + + +
+ {@const lastLine = lastTestLine(full)} + {@const used = row.last_used_at ? `${t('wl.lastUsed')}:${formatDbTime(row.last_used_at)}` : null} + {@const recheck = recheckLine(row)} + {#if lastLine || used || recheck} +
+ {#if used}{used}{/if} + {#if lastLine}{t('conn.wfLastTest')}:{lastLine}{/if} + {#if recheck} + + {recheck.text} + + {/if} +
+ {/if} + {#if wfMapEditId === row.id && full} +
+

{t('conn.wfOutputHint')}

+
+ {#each (full.output_schema ?? []).filter((o) => o.evidence === 'unknown_node') as c (c.nodeId)} +
+ + +
+ {/each} +
+
+ + +
+
+ {/if} + {/each} +
+ {#if filtered.length > visibleCount} + + {/if} + {/if} + {/if} +
+ + client.invalidateQueries({ queryKey: ['workflows'] })} +/> + client.invalidateQueries({ queryKey: ['workflows'] })} +/> + { + client.invalidateQueries({ queryKey: ['workflows'] }); + if (testWf) { + delete fullCache[testWf.id]; + void ensureFull(testWf.id); + } + }} +/> + + + $dedupeMutation.mutate()} +/> + + diff --git a/calliope-web/src/lib/components/workflows/WorkflowMetaDialog.svelte b/calliope-web/src/lib/components/workflows/WorkflowMetaDialog.svelte new file mode 100644 index 00000000..4addb713 --- /dev/null +++ b/calliope-web/src/lib/components/workflows/WorkflowMetaDialog.svelte @@ -0,0 +1,259 @@ + + + +
+ {#if isBatch} +

+ + {t('md.batchHint')} +

+
+ + +
+

{t('md.nameHint')}

+ {:else} + + {/if} + + + + + +
+ + +
+
+ + {#snippet footer()} + + + {/snippet} +
+ + diff --git a/calliope-web/src/lib/i18n/de.ts b/calliope-web/src/lib/i18n/de.ts index 6a23d0b5..0cf78850 100644 --- a/calliope-web/src/lib/i18n/de.ts +++ b/calliope-web/src/lib/i18n/de.ts @@ -2097,4 +2097,136 @@ export const de: Dict = { 'wfd.nodesPickSuggest': 'Wähle unten die Verwendung und schließe die Ausgangszuordnung ab, bevor du speicherst.', 'wfd.showRaw': 'Rohes JSON anzeigen', 'wfd.hideRaw': 'Rohes JSON ausblenden', + + // --- Workflow library · batch import & management (HEL-682) --- + 'wl.hint': 'UI-Format-Workflows stapelweise importieren; suchen, filtern, annotieren — volles JSON nur bei Bedarf', + 'wl.batchImport': 'Stapelimport', + 'wl.dedupe': 'Duplikate entfernen', + 'wl.dedupeTitle': 'Duplizierte Workflows entfernen', + 'wl.dedupeConfirm': 'Einträge mit identischem Namen UND Inhalt werden gelöscht (der früheste Import bleibt). Gleicher Name mit anderem Inhalt bleibt unangetastet. Fortfahren?', + 'wl.dedupeDone': '{n} doppelte Workflows entfernt', + 'wl.dedupeNone': 'Keine doppelten Workflows gefunden', + 'wl.favCount': '{n} Favoriten', + 'wl.searchPh': 'Name, Beschreibung, Tags, Modell suchen… (/ drücken)', + 'wl.filterLabel': 'Filter', + 'wl.filterAll': 'Alle', + 'wl.filterFav': 'Favoriten', + 'wl.filterPending': 'Offen', + 'wl.filterDisabled': 'Deaktiviert', + 'wl.favAria': 'Favorisieren', + 'wl.unfavAria': 'Favorit entfernen', + 'wl.categoryLabel': 'Kategorie', + 'wl.categoryAll': 'Alle Kategorien', + 'wl.familyLabel': 'Modellfamilie', + 'wl.familyAll': 'Alle Familien', + 'wl.mediaLabel': 'Medium', + 'wl.mediaAll': 'Alle Medien', + 'wl.mediaImage': 'Bild', + 'wl.mediaVideo': 'Video', + 'wl.mediaAudio': 'Audio', + 'wl.mediaIn': 'Eingabe', + 'wl.mediaOut': 'Ausgabe', + 'wl.sortLabel': 'Sortierung', + 'wl.sortRecent': 'Favoriten / zuletzt', + 'wl.sortName': 'Name', + 'wl.resetFilters': 'Filter zurücksetzen', + 'wl.noMatch': 'Keine Workflows entsprechen den Filtern', + 'wl.resultCount': '{n} von {m}', + 'wl.selected': '{n} ausgewählt', + 'wl.batchLabel': 'Stapelaktionen', + 'wl.batchAnnotate': 'Annotieren', + 'wl.batchEnable': 'Aktivieren', + 'wl.batchDisable': 'Deaktivieren', + 'wl.clearSel': 'Auswahl aufheben', + 'wl.batchDone': '{n} Workflows aktualisiert', + 'wl.batchPartial': '{n} erfolgreich, {m} fehlgeschlagen (zuerst Verwendung und Ausgabe klären)', + 'wl.selectAll': 'Alle aufgelisteten Workflows auswählen', + 'wl.rowCheckAria': '{name} auswählen', + 'wl.headMeta': 'Metadaten', + 'wl.headActions': 'Aktionen', + 'wl.enableAria': '{name} aktivieren oder deaktivieren', + 'wl.enableBlocked': 'Verwendung und Ausgabeknoten vor Aktivierung festlegen', + 'wl.editMeta': 'Metadaten bearbeiten', + 'wl.lastUsed': 'Zuletzt verwendet', + 'wl.moreCount': '{n} mehr anzeigen ({m} gesamt)', + 'wfCat.basic': 'Grundverarbeitung', + 'wfCat.audioTts': 'Sprachgenerierung', + 'wfCat.music': 'Musikgenerierung', + 'wfCat.image': 'Bildgenerierung', + 'wfCat.video': 'Videogenerierung', + 'wfCat.digitalHuman': 'Digitaler Mensch', + 'wfCat.motionTransfer': 'Bewegungsübertragung', + 'md.title': 'Workflow-Metadaten', + 'md.batchTitle': 'Stapel-Annotieren ({n})', + 'md.batchHint': 'Nur ausgefüllte Felder werden angewendet; Namen per Suchen→Ersetzen, Tags werden ergänzt.', + 'md.name': 'Anzeigename', + 'md.nameFind': 'Suchen', + 'md.nameFindPh': 'Zu ersetzender Text…', + 'md.nameReplace': 'Ersetzen mit', + 'md.nameReplacePh': 'Ersatztext…', + 'md.nameHint': 'Leeres „Suchen“ lässt Namen unverändert.', + 'md.description': 'Beschreibung', + 'md.descriptionPh': 'Eine Zeile, was dieser Workflow tut…', + 'md.tags': 'Tags', + 'md.tagsPh': 'z. B. schnell, hohe Qualität', + 'md.tagsHint': 'Kommagetrennt; im Stapelmodus werden sie ergänzt.', + 'md.category': 'Kategorie', + 'md.modelFamily': 'Modellfamilie', + 'md.apply': 'Anwenden', + 'md.applied': '{n} Workflows aktualisiert', + 'md.appliedOne': 'Aktualisiert', + 'md.partial': '{n} erfolgreich, {m} fehlgeschlagen', + 'wiz.title': 'Workflows stapelweise importieren', + 'wiz.stepSource': 'Quelle', + 'wiz.stepReport': 'Prüfbericht', + 'wiz.stepResult': 'Ergebnis', + 'wiz.sourceLabel': 'Importquelle', + 'wiz.modeScan': 'Serververzeichnis scannen', + 'wiz.modeFiles': 'Lokale Dateien wählen', + 'wiz.rootLabel': 'Serververzeichnis', + 'wiz.rootHint': 'Ein Verzeichnispfad auf dem Server (z. B. example_ComfyUI_workflows des Repos); UI-Format-JSONs werden rekursiv gescannt, API-Format und andere übersprungen.', + 'wiz.preflight': 'Preflight gegen echtes ComfyUI (optional)', + 'wiz.preflightNone': 'Überspringen (Offline-Konvertierung)', + 'wiz.preflightHint': 'Mit gewählter Verbindung werden konvertierte Graphen Knoten für Knoten geprüft.', + 'wiz.pickFiles': 'Lokale Dateien', + 'wiz.pickFilesBtn': 'JSON-Dateien wählen (mehrere)', + 'wiz.pickFilesHint': 'ComfyUI-Workflows im UI-Format wählen; Mehrfachauswahl möglich.', + 'wiz.parsed': '{n} Dateien gelesen', + 'wiz.notUi': '{n} Dateien sind kein UI-Format (kein nodes-Array) und wurden übersprungen', + 'wiz.noFiles': 'Zuerst Dateien zum Import auswählen', + 'wiz.runDry': 'Probelauf starten (nichts wird gespeichert)', + 'wiz.running': 'Prüfe…', + 'wiz.total': '{n} Dateien', + 'wiz.ok': 'OK {n}', + 'wiz.warn': 'Warnung {n}', + 'wiz.fail': 'Fehler {n}', + 'wiz.confirmCount': 'Prüfung nötig {n}', + 'wiz.importable': 'Importierbar {n}', + 'wiz.reportHint': 'Der Probelauf speichert nichts. Warnungen werden aktiviert importiert, sobald eine Verwendung angegeben ist; prüfungspflichtige und fehlgeschlagene Dateien werden nie importiert.', + 'wiz.filterLabel': 'Berichtsfilter', + 'wiz.filterWarn': 'Nur Warnungen', + 'wiz.filterBlocked': 'Nicht importierbar', + 'wiz.searchPh': 'Dateinamen suchen…', + 'wiz.includeAria': '{name} importieren', + 'wiz.skipReason': 'Nicht importierbar: {reason}', + 'wiz.issues': '{n} Konvertierungshinweise', + 'wiz.usagePick': 'Verwendung:', + 'wiz.usageNone': 'Vorerst überspringen (nach Import offen)', + 'wiz.selectedN': '{n} Dateien werden importiert', + 'wiz.excludedM': '{m} nicht importierbar', + 'wiz.import': 'Importieren', + 'wiz.importing': 'Importiere…', + 'wiz.back': 'Zurück', + 'wiz.imported': '{n} importiert', + 'wiz.skipped': '{n} übersprungen', + 'wiz.conflict': 'Existiert bereits (Duplikat übersprungen)', + 'wiz.usageApplied': 'Verwendung für {n} neue Importe gesetzt', + 'wiz.done': 'Fertig', + 'wiz.again': 'Weitere Charge importieren', + 'wiz.resultNote': 'Dateien mit identischem Inhalt werden automatisch übersprungen — Wiederholung erzeugt keine Duplikate.', + 'wiz.importedToast': '{n} Workflows importiert', + 'wiz.warnTag': 'Warnung', + 'wiz.confirmTag': 'Prüfung nötig', + 'wiz.preflightTag': 'Preflight fehlgeschlagen', + 'wiz.importedTag': 'Importiert #{id}', }; diff --git a/calliope-web/src/lib/i18n/en.ts b/calliope-web/src/lib/i18n/en.ts index 14c5b3cc..6827823b 100644 --- a/calliope-web/src/lib/i18n/en.ts +++ b/calliope-web/src/lib/i18n/en.ts @@ -2096,6 +2096,138 @@ export const en = { 'wfd.nodesPickSuggest': 'Pick the usage and finish the output mapping below before saving.', 'wfd.showRaw': 'View raw JSON', 'wfd.hideRaw': 'Hide raw JSON', + + // --- Workflow library · batch import & management (HEL-682) --- + 'wl.hint': 'Batch-import UI-format workflows; search, filter and annotate — full JSON loads only per action', + 'wl.batchImport': 'Batch import', + 'wl.dedupe': 'Dedupe', + 'wl.dedupeTitle': 'Remove duplicate workflows', + 'wl.dedupeConfirm': 'This deletes entries whose name AND content are identical (the earliest import is kept). Same name with different content is your variant and stays untouched. Continue?', + 'wl.dedupeDone': 'Removed {n} duplicate workflows', + 'wl.dedupeNone': 'No duplicate workflows found', + 'wl.favCount': '{n} favorites', + 'wl.searchPh': 'Search name, description, tags, model… (press /)', + 'wl.filterLabel': 'Filters', + 'wl.filterAll': 'All', + 'wl.filterFav': 'Favorites', + 'wl.filterPending': 'Pending', + 'wl.filterDisabled': 'Disabled', + 'wl.favAria': 'Favorite', + 'wl.unfavAria': 'Unfavorite', + 'wl.categoryLabel': 'Category', + 'wl.categoryAll': 'All categories', + 'wl.familyLabel': 'Model family', + 'wl.familyAll': 'All families', + 'wl.mediaLabel': 'Media', + 'wl.mediaAll': 'All media', + 'wl.mediaImage': 'Image', + 'wl.mediaVideo': 'Video', + 'wl.mediaAudio': 'Audio', + 'wl.mediaIn': 'Input', + 'wl.mediaOut': 'Output', + 'wl.sortLabel': 'Sort', + 'wl.sortRecent': 'Favorite / recent', + 'wl.sortName': 'Name', + 'wl.resetFilters': 'Clear filters', + 'wl.noMatch': 'No workflows match the current filters', + 'wl.resultCount': '{n} of {m} match', + 'wl.selected': '{n} selected', + 'wl.batchLabel': 'Batch actions', + 'wl.batchAnnotate': 'Annotate', + 'wl.batchEnable': 'Enable', + 'wl.batchDisable': 'Disable', + 'wl.clearSel': 'Clear selection', + 'wl.batchDone': 'Updated {n} workflows', + 'wl.batchPartial': '{n} succeeded, {m} failed (usage and output mapping must be settled first)', + 'wl.selectAll': 'Select all listed workflows', + 'wl.rowCheckAria': 'Select {name}', + 'wl.headMeta': 'Metadata', + 'wl.headActions': 'Actions', + 'wl.enableAria': 'Enable or disable {name}', + 'wl.enableBlocked': 'Settle usage and output nodes before enabling', + 'wl.editMeta': 'Edit metadata', + 'wl.lastUsed': 'Last used', + 'wl.moreCount': 'Show {n} more ({m} total)', + 'wfCat.basic': 'Basic processing', + 'wfCat.audioTts': 'Speech generation', + 'wfCat.music': 'Music generation', + 'wfCat.image': 'Image generation', + 'wfCat.video': 'Video generation', + 'wfCat.digitalHuman': 'Digital human', + 'wfCat.motionTransfer': 'Motion transfer', + 'md.title': 'Workflow metadata', + 'md.batchTitle': 'Batch annotate ({n})', + 'md.batchHint': 'Only filled fields are applied; names are renamed via find→replace and tags are appended.', + 'md.name': 'Display name', + 'md.nameFind': 'Find', + 'md.nameFindPh': 'Text to replace…', + 'md.nameReplace': 'Replace with', + 'md.nameReplacePh': 'Replacement text…', + 'md.nameHint': 'Leave “Find” empty to keep names unchanged.', + 'md.description': 'Description', + 'md.descriptionPh': 'One line about what this workflow does…', + 'md.tags': 'Tags', + 'md.tagsPh': 'e.g. fast, high quality', + 'md.tagsHint': 'Comma separated; appended in batch mode.', + 'md.category': 'Category', + 'md.modelFamily': 'Model family', + 'md.apply': 'Apply', + 'md.applied': 'Updated {n} workflows', + 'md.appliedOne': 'Updated', + 'md.partial': '{n} succeeded, {m} failed', + 'wiz.title': 'Batch import workflows', + 'wiz.stepSource': 'Source', + 'wiz.stepReport': 'Dry-run report', + 'wiz.stepResult': 'Result', + 'wiz.sourceLabel': 'Import source', + 'wiz.modeScan': 'Scan server directory', + 'wiz.modeFiles': 'Pick local files', + 'wiz.rootLabel': 'Server directory', + 'wiz.rootHint': 'A directory path on the server (e.g. the repo’s example_ComfyUI_workflows); UI-format ComfyUI JSONs inside are scanned recursively — API-format and other JSONs are skipped.', + 'wiz.preflight': 'Preflight against a live ComfyUI (optional)', + 'wiz.preflightNone': 'Skip (offline conversion)', + 'wiz.preflightHint': 'With a connection selected, converted graphs are checked node-by-node against that ComfyUI.', + 'wiz.pickFiles': 'Local files', + 'wiz.pickFilesBtn': 'Choose JSON files (multiple)', + 'wiz.pickFilesHint': 'Pick ComfyUI UI-format workflow JSONs; multiple selection supported.', + 'wiz.parsed': '{n} files read', + 'wiz.notUi': '{n} files are not UI-format (no nodes array) and were skipped', + 'wiz.noFiles': 'Choose files to import first', + 'wiz.runDry': 'Run dry-run (nothing stored)', + 'wiz.running': 'Checking…', + 'wiz.total': '{n} files', + 'wiz.ok': 'OK {n}', + 'wiz.warn': 'Warn {n}', + 'wiz.fail': 'Fail {n}', + 'wiz.confirmCount': 'Need review {n}', + 'wiz.importable': 'Importable {n}', + 'wiz.reportHint': 'The dry-run stores nothing. Warn items import enabled once a usage is supplied; needs-review and failed items are never imported nor marked runnable.', + 'wiz.filterLabel': 'Report filters', + 'wiz.filterWarn': 'Warnings only', + 'wiz.filterBlocked': 'Not importable', + 'wiz.searchPh': 'Search file name…', + 'wiz.includeAria': 'Import {name}', + 'wiz.skipReason': 'Not importable: {reason}', + 'wiz.issues': '{n} conversion notes', + 'wiz.usagePick': 'Usage:', + 'wiz.usageNone': 'Skip for now (pending after import)', + 'wiz.selectedN': '{n} files will be imported', + 'wiz.excludedM': '{m} not importable', + 'wiz.import': 'Import', + 'wiz.importing': 'Importing…', + 'wiz.back': 'Back', + 'wiz.imported': 'Imported {n}', + 'wiz.skipped': 'Skipped {n}', + 'wiz.conflict': 'Already exists (duplicate skipped)', + 'wiz.usageApplied': 'Usage supplied for {n} new imports', + 'wiz.done': 'Done', + 'wiz.again': 'Import another batch', + 'wiz.resultNote': 'Files with identical content are skipped automatically — re-running never creates duplicates.', + 'wiz.importedToast': 'Imported {n} workflows', + 'wiz.warnTag': 'Warn', + 'wiz.confirmTag': 'Needs review', + 'wiz.preflightTag': 'Preflight failed', + 'wiz.importedTag': 'Imported #{id}', }; export type Dict = typeof en; diff --git a/calliope-web/src/lib/i18n/es.ts b/calliope-web/src/lib/i18n/es.ts index 464d9c77..b33d3850 100644 --- a/calliope-web/src/lib/i18n/es.ts +++ b/calliope-web/src/lib/i18n/es.ts @@ -2097,4 +2097,136 @@ export const es: Dict = { 'wfd.nodesPickSuggest': 'Elige el uso y completa el mapeo de salida abajo antes de guardar.', 'wfd.showRaw': 'Ver JSON original', 'wfd.hideRaw': 'Ocultar JSON original', + + // --- Workflow library · batch import & management (HEL-682) --- + 'wl.hint': 'Importa por lotes flujos en formato UI; busca, filtra y anota — el JSON completo solo se carga al actuar', + 'wl.batchImport': 'Importar por lotes', + 'wl.dedupe': 'Deduplicar', + 'wl.dedupeTitle': 'Eliminar flujos duplicados', + 'wl.dedupeConfirm': 'Se eliminan las entradas con nombre Y contenido idénticos (se conserva la primera importada). Mismo nombre con contenido distinto no se toca. ¿Continuar?', + 'wl.dedupeDone': 'Se eliminaron {n} flujos duplicados', + 'wl.dedupeNone': 'No se encontraron flujos duplicados', + 'wl.favCount': '{n} favoritos', + 'wl.searchPh': 'Buscar nombre, descripción, etiquetas, modelo… (pulsa /)', + 'wl.filterLabel': 'Filtros', + 'wl.filterAll': 'Todos', + 'wl.filterFav': 'Favoritos', + 'wl.filterPending': 'Pendientes', + 'wl.filterDisabled': 'Desactivados', + 'wl.favAria': 'Marcar como favorito', + 'wl.unfavAria': 'Quitar de favoritos', + 'wl.categoryLabel': 'Categoría', + 'wl.categoryAll': 'Todas las categorías', + 'wl.familyLabel': 'Familia de modelo', + 'wl.familyAll': 'Todas las familias', + 'wl.mediaLabel': 'Medio', + 'wl.mediaAll': 'Todos los medios', + 'wl.mediaImage': 'Imagen', + 'wl.mediaVideo': 'Vídeo', + 'wl.mediaAudio': 'Audio', + 'wl.mediaIn': 'Entrada', + 'wl.mediaOut': 'Salida', + 'wl.sortLabel': 'Orden', + 'wl.sortRecent': 'Favoritos / recientes', + 'wl.sortName': 'Nombre', + 'wl.resetFilters': 'Limpiar filtros', + 'wl.noMatch': 'Ningún flujo coincide con los filtros', + 'wl.resultCount': '{n} de {m}', + 'wl.selected': '{n} seleccionados', + 'wl.batchLabel': 'Acciones por lotes', + 'wl.batchAnnotate': 'Anotar', + 'wl.batchEnable': 'Activar', + 'wl.batchDisable': 'Desactivar', + 'wl.clearSel': 'Limpiar selección', + 'wl.batchDone': '{n} flujos actualizados', + 'wl.batchPartial': '{n} con éxito, {m} fallidos (confirma antes uso y salida)', + 'wl.selectAll': 'Seleccionar todos los flujos listados', + 'wl.rowCheckAria': 'Seleccionar {name}', + 'wl.headMeta': 'Metadatos', + 'wl.headActions': 'Acciones', + 'wl.enableAria': 'Activar o desactivar {name}', + 'wl.enableBlocked': 'Confirma uso y nodos de salida antes de activar', + 'wl.editMeta': 'Editar metadatos', + 'wl.lastUsed': 'Último uso', + 'wl.moreCount': 'Mostrar {n} más ({m} en total)', + 'wfCat.basic': 'Procesamiento básico', + 'wfCat.audioTts': 'Generación de voz', + 'wfCat.music': 'Generación de música', + 'wfCat.image': 'Generación de imágenes', + 'wfCat.video': 'Generación de vídeo', + 'wfCat.digitalHuman': 'Humano digital', + 'wfCat.motionTransfer': 'Transferencia de movimiento', + 'md.title': 'Metadatos del flujo', + 'md.batchTitle': 'Anotar por lotes ({n})', + 'md.batchHint': 'Solo se aplican los campos rellenados; los nombres se renombran con buscar→reemplazar y las etiquetas se añaden.', + 'md.name': 'Nombre visible', + 'md.nameFind': 'Buscar', + 'md.nameFindPh': 'Texto a reemplazar…', + 'md.nameReplace': 'Reemplazar por', + 'md.nameReplacePh': 'Texto de reemplazo…', + 'md.nameHint': 'Deja «Buscar» vacío para no cambiar nombres.', + 'md.description': 'Descripción', + 'md.descriptionPh': 'Una línea sobre qué hace este flujo…', + 'md.tags': 'Etiquetas', + 'md.tagsPh': 'p. ej. rápido, alta calidad', + 'md.tagsHint': 'Separadas por comas; en lote se añaden.', + 'md.category': 'Categoría', + 'md.modelFamily': 'Familia de modelo', + 'md.apply': 'Aplicar', + 'md.applied': '{n} flujos actualizados', + 'md.appliedOne': 'Actualizado', + 'md.partial': '{n} con éxito, {m} fallidos', + 'wiz.title': 'Importar flujos por lotes', + 'wiz.stepSource': 'Origen', + 'wiz.stepReport': 'Informe de prueba', + 'wiz.stepResult': 'Resultado', + 'wiz.sourceLabel': 'Origen de importación', + 'wiz.modeScan': 'Escanear carpeta del servidor', + 'wiz.modeFiles': 'Elegir archivos locales', + 'wiz.rootLabel': 'Carpeta del servidor', + 'wiz.rootHint': 'Ruta de carpeta en el servidor (p. ej. example_ComfyUI_workflows del repo); se escanean recursivamente los JSON en formato UI, el formato API y otros JSON se omiten.', + 'wiz.preflight': 'Preflight contra un ComfyUI real (opcional)', + 'wiz.preflightNone': 'Omitir (conversión sin conexión)', + 'wiz.preflightHint': 'Con una conexión elegida, los grafos convertidos se verifican nodo a nodo.', + 'wiz.pickFiles': 'Archivos locales', + 'wiz.pickFilesBtn': 'Elegir archivos JSON (varios)', + 'wiz.pickFilesHint': 'Elige JSON de flujos ComfyUI en formato UI; se admite selección múltiple.', + 'wiz.parsed': '{n} archivos leídos', + 'wiz.notUi': '{n} archivos no son formato UI (sin array nodes) y se omitieron', + 'wiz.noFiles': 'Elige primero los archivos a importar', + 'wiz.runDry': 'Ejecutar prueba (no se guarda nada)', + 'wiz.running': 'Comprobando…', + 'wiz.total': '{n} archivos', + 'wiz.ok': 'OK {n}', + 'wiz.warn': 'Avisos {n}', + 'wiz.fail': 'Fallos {n}', + 'wiz.confirmCount': 'Requieren revisión {n}', + 'wiz.importable': 'Importables {n}', + 'wiz.reportHint': 'La prueba no guarda nada. Los avisos se importan activados al indicar un uso; los que requieren revisión o fallaron nunca se importan.', + 'wiz.filterLabel': 'Filtros del informe', + 'wiz.filterWarn': 'Solo avisos', + 'wiz.filterBlocked': 'No importables', + 'wiz.searchPh': 'Buscar nombre de archivo…', + 'wiz.includeAria': 'Importar {name}', + 'wiz.skipReason': 'No importable: {reason}', + 'wiz.issues': '{n} notas de conversión', + 'wiz.usagePick': 'Uso:', + 'wiz.usageNone': 'Omitir por ahora (pendiente tras importar)', + 'wiz.selectedN': 'Se importarán {n} archivos', + 'wiz.excludedM': '{m} no importables', + 'wiz.import': 'Importar', + 'wiz.importing': 'Importando…', + 'wiz.back': 'Atrás', + 'wiz.imported': '{n} importados', + 'wiz.skipped': '{n} omitidos', + 'wiz.conflict': 'Ya existe (duplicado omitido)', + 'wiz.usageApplied': 'Uso indicado para {n} importaciones nuevas', + 'wiz.done': 'Hecho', + 'wiz.again': 'Importar otro lote', + 'wiz.resultNote': 'Los archivos con contenido idéntico se omiten automáticamente; repetir no crea duplicados.', + 'wiz.importedToast': '{n} flujos importados', + 'wiz.warnTag': 'Aviso', + 'wiz.confirmTag': 'Requiere revisión', + 'wiz.preflightTag': 'Preflight fallido', + 'wiz.importedTag': 'Importado #{id}', }; diff --git a/calliope-web/src/lib/i18n/fr.ts b/calliope-web/src/lib/i18n/fr.ts index 376cd898..0483b4d3 100644 --- a/calliope-web/src/lib/i18n/fr.ts +++ b/calliope-web/src/lib/i18n/fr.ts @@ -2097,4 +2097,136 @@ export const fr: Dict = { 'wfd.nodesPickSuggest': "Choisissez l'usage et terminez le mappage des sorties ci-dessous avant d'enregistrer.", 'wfd.showRaw': 'Voir le JSON brut', 'wfd.hideRaw': 'Masquer le JSON brut', + + // --- Workflow library · batch import & management (HEL-682) --- + 'wl.hint': 'Importez par lots des flux au format UI ; cherchez, filtrez, annotez — le JSON complet ne se charge qu’à l’action', + 'wl.batchImport': 'Import par lot', + 'wl.dedupe': 'Dédupliquer', + 'wl.dedupeTitle': 'Supprimer les flux dupliqués', + 'wl.dedupeConfirm': 'Les entrées au nom ET contenu identiques seront supprimées (le premier import est conservé). Même nom mais contenu différent = votre variante, intact. Continuer ?', + 'wl.dedupeDone': '{n} flux dupliqués supprimés', + 'wl.dedupeNone': 'Aucun flux dupliqué trouvé', + 'wl.favCount': '{n} favoris', + 'wl.searchPh': 'Rechercher nom, description, tags, modèle… (touche /)', + 'wl.filterLabel': 'Filtres', + 'wl.filterAll': 'Tous', + 'wl.filterFav': 'Favoris', + 'wl.filterPending': 'À confirmer', + 'wl.filterDisabled': 'Désactivés', + 'wl.favAria': 'Mettre en favori', + 'wl.unfavAria': 'Retirer des favoris', + 'wl.categoryLabel': 'Catégorie', + 'wl.categoryAll': 'Toutes les catégories', + 'wl.familyLabel': 'Famille de modèle', + 'wl.familyAll': 'Toutes les familles', + 'wl.mediaLabel': 'Média', + 'wl.mediaAll': 'Tous les médias', + 'wl.mediaImage': 'Image', + 'wl.mediaVideo': 'Vidéo', + 'wl.mediaAudio': 'Audio', + 'wl.mediaIn': 'Entrée', + 'wl.mediaOut': 'Sortie', + 'wl.sortLabel': 'Tri', + 'wl.sortRecent': 'Favoris / récents', + 'wl.sortName': 'Nom', + 'wl.resetFilters': 'Effacer les filtres', + 'wl.noMatch': 'Aucun flux ne correspond aux filtres', + 'wl.resultCount': '{n} sur {m}', + 'wl.selected': '{n} sélectionnés', + 'wl.batchLabel': 'Actions groupées', + 'wl.batchAnnotate': 'Annoter', + 'wl.batchEnable': 'Activer', + 'wl.batchDisable': 'Désactiver', + 'wl.clearSel': 'Effacer la sélection', + 'wl.batchDone': '{n} flux mis à jour', + 'wl.batchPartial': '{n} réussis, {m} échoués (usage et sortie à confirmer d’abord)', + 'wl.selectAll': 'Sélectionner tous les flux listés', + 'wl.rowCheckAria': 'Sélectionner {name}', + 'wl.headMeta': 'Métadonnées', + 'wl.headActions': 'Actions', + 'wl.enableAria': 'Activer ou désactiver {name}', + 'wl.enableBlocked': 'Confirmez l’usage et les nœuds de sortie avant activation', + 'wl.editMeta': 'Modifier les métadonnées', + 'wl.lastUsed': 'Dernière utilisation', + 'wl.moreCount': 'Afficher {n} de plus ({m} au total)', + 'wfCat.basic': 'Traitement de base', + 'wfCat.audioTts': 'Génération de voix', + 'wfCat.music': 'Génération de musique', + 'wfCat.image': 'Génération d’images', + 'wfCat.video': 'Génération de vidéo', + 'wfCat.digitalHuman': 'Humain numérique', + 'wfCat.motionTransfer': 'Transfert de mouvement', + 'md.title': 'Métadonnées du flux', + 'md.batchTitle': 'Annotation groupée ({n})', + 'md.batchHint': 'Seuls les champs remplis sont appliqués ; renommage par rechercher→remplacer, tags ajoutés.', + 'md.name': 'Nom affiché', + 'md.nameFind': 'Rechercher', + 'md.nameFindPh': 'Texte à remplacer…', + 'md.nameReplace': 'Remplacer par', + 'md.nameReplacePh': 'Texte de remplacement…', + 'md.nameHint': 'Laissez « Rechercher » vide pour ne pas renommer.', + 'md.description': 'Description', + 'md.descriptionPh': 'Une ligne sur ce que fait ce flux…', + 'md.tags': 'Tags', + 'md.tagsPh': 'ex. rapide, haute qualité', + 'md.tagsHint': 'Séparés par des virgules ; ajoutés en mode groupé.', + 'md.category': 'Catégorie', + 'md.modelFamily': 'Famille de modèle', + 'md.apply': 'Appliquer', + 'md.applied': '{n} flux mis à jour', + 'md.appliedOne': 'Mis à jour', + 'md.partial': '{n} réussis, {m} échoués', + 'wiz.title': 'Import de flux par lot', + 'wiz.stepSource': 'Source', + 'wiz.stepReport': 'Rapport de test', + 'wiz.stepResult': 'Résultat', + 'wiz.sourceLabel': 'Source d’import', + 'wiz.modeScan': 'Scanner un dossier serveur', + 'wiz.modeFiles': 'Choisir des fichiers locaux', + 'wiz.rootLabel': 'Dossier serveur', + 'wiz.rootHint': 'Chemin d’un dossier sur le serveur (ex. example_ComfyUI_workflows du dépôt) ; les JSON au format UI sont scannés récursivement, le format API et les autres sont ignorés.', + 'wiz.preflight': 'Pré-vérification sur un ComfyUI réel (facultatif)', + 'wiz.preflightNone': 'Passer (conversion hors ligne)', + 'wiz.preflightHint': 'Avec une connexion choisie, les graphes convertis sont vérifiés nœud par nœud.', + 'wiz.pickFiles': 'Fichiers locaux', + 'wiz.pickFilesBtn': 'Choisir des fichiers JSON (plusieurs)', + 'wiz.pickFilesHint': 'Choisissez des flux ComfyUI au format UI ; sélection multiple possible.', + 'wiz.parsed': '{n} fichiers lus', + 'wiz.notUi': '{n} fichiers ne sont pas au format UI (pas de tableau nodes), ignorés', + 'wiz.noFiles': 'Choisissez d’abord des fichiers à importer', + 'wiz.runDry': 'Lancer le test (rien n’est enregistré)', + 'wiz.running': 'Vérification…', + 'wiz.total': '{n} fichiers', + 'wiz.ok': 'OK {n}', + 'wiz.warn': 'Avertissements {n}', + 'wiz.fail': 'Échecs {n}', + 'wiz.confirmCount': 'À vérifier {n}', + 'wiz.importable': 'Importables {n}', + 'wiz.reportHint': 'Le test n’écrit rien. Les avertissements s’importent activés dès qu’un usage est fourni ; les fichiers à vérifier ou en échec ne sont jamais importés.', + 'wiz.filterLabel': 'Filtres du rapport', + 'wiz.filterWarn': 'Avertissements seuls', + 'wiz.filterBlocked': 'Non importables', + 'wiz.searchPh': 'Rechercher un nom de fichier…', + 'wiz.includeAria': 'Importer {name}', + 'wiz.skipReason': 'Non importable : {reason}', + 'wiz.issues': '{n} notes de conversion', + 'wiz.usagePick': 'Usage :', + 'wiz.usageNone': 'Passer pour l’instant (à confirmer après import)', + 'wiz.selectedN': '{n} fichiers seront importés', + 'wiz.excludedM': '{m} non importables', + 'wiz.import': 'Importer', + 'wiz.importing': 'Import…', + 'wiz.back': 'Retour', + 'wiz.imported': '{n} importés', + 'wiz.skipped': '{n} ignorés', + 'wiz.conflict': 'Existe déjà (doublon ignoré)', + 'wiz.usageApplied': 'Usage fourni pour {n} nouveaux imports', + 'wiz.done': 'Terminé', + 'wiz.again': 'Importer un autre lot', + 'wiz.resultNote': 'Les fichiers au contenu identique sont ignorés automatiquement — relancer ne crée jamais de doublons.', + 'wiz.importedToast': '{n} flux importés', + 'wiz.warnTag': 'Avertissement', + 'wiz.confirmTag': 'À vérifier', + 'wiz.preflightTag': 'Pré-vérification échouée', + 'wiz.importedTag': 'Importé #{id}', }; diff --git a/calliope-web/src/lib/i18n/ja.ts b/calliope-web/src/lib/i18n/ja.ts index 07def35c..70d72bd4 100644 --- a/calliope-web/src/lib/i18n/ja.ts +++ b/calliope-web/src/lib/i18n/ja.ts @@ -2095,4 +2095,136 @@ export const ja: Dict = { 'wfd.nodesPickSuggest': '保存前に下で用途を選び、出力マッピングを完了してください。', 'wfd.showRaw': '元の JSON を見る', 'wfd.hideRaw': '元の JSON を閉じる', + + // --- Workflow library · batch import & management (HEL-682) --- + 'wl.hint': 'UI 形式ワークフローを一括取り込み、検索・絞り込み・注釈管理。完全な JSON は操作時のみ読み込み', + 'wl.batchImport': '一括取り込み', + 'wl.dedupe': '重複を削除', + 'wl.dedupeTitle': '重複ワークフローの削除', + 'wl.dedupeConfirm': '名前と内容が完全に同一の項目を削除します(最初に取り込んだものを残す)。名前が同じでも内容が異なるものは触れません。実行しますか?', + 'wl.dedupeDone': '重複 {n} 件を削除しました', + 'wl.dedupeNone': '重複するワークフローはありません', + 'wl.favCount': 'お気に入り {n} 件', + 'wl.searchPh': '名前・説明・タグ・モデルを検索…(/ で移動)', + 'wl.filterLabel': '絞り込み', + 'wl.filterAll': 'すべて', + 'wl.filterFav': 'お気に入り', + 'wl.filterPending': '要確認', + 'wl.filterDisabled': '無効', + 'wl.favAria': 'お気に入りに追加', + 'wl.unfavAria': 'お気に入りから外す', + 'wl.categoryLabel': 'カテゴリ', + 'wl.categoryAll': 'すべてのカテゴリ', + 'wl.familyLabel': 'モデルファミリー', + 'wl.familyAll': 'すべてのファミリー', + 'wl.mediaLabel': 'メディア', + 'wl.mediaAll': 'すべてのメディア', + 'wl.mediaImage': '画像', + 'wl.mediaVideo': '動画', + 'wl.mediaAudio': '音声', + 'wl.mediaIn': '入力', + 'wl.mediaOut': '出力', + 'wl.sortLabel': '並び替え', + 'wl.sortRecent': 'お気に入り / 最近', + 'wl.sortName': '名前', + 'wl.resetFilters': '絞り込みを解除', + 'wl.noMatch': '条件に合うワークフローがありません', + 'wl.resultCount': '{n} / {m} 件', + 'wl.selected': '{n} 件選択中', + 'wl.batchLabel': '一括操作', + 'wl.batchAnnotate': '一括注釈', + 'wl.batchEnable': '有効化', + 'wl.batchDisable': '無効化', + 'wl.clearSel': '選択を解除', + 'wl.batchDone': '{n} 件を更新しました', + 'wl.batchPartial': '{n} 件成功、{m} 件失敗(用途と出力の確認が必要)', + 'wl.selectAll': '表示中のワークフローをすべて選択', + 'wl.rowCheckAria': '{name} を選択', + 'wl.headMeta': 'メタデータ', + 'wl.headActions': '操作', + 'wl.enableAria': '{name} を有効化・無効化', + 'wl.enableBlocked': '用途と出力ノードを確定してから有効化してください', + 'wl.editMeta': 'メタデータを編集', + 'wl.lastUsed': '最終使用', + 'wl.moreCount': 'さらに {n} 件表示(全 {m} 件)', + 'wfCat.basic': '基本処理', + 'wfCat.audioTts': '音声生成', + 'wfCat.music': '音楽生成', + 'wfCat.image': '画像生成', + 'wfCat.video': '動画生成', + 'wfCat.digitalHuman': 'デジタルヒューマン', + 'wfCat.motionTransfer': 'モーション転送', + 'md.title': 'ワークフローの注釈', + 'md.batchTitle': '一括注釈({n} 件)', + 'md.batchHint': '入力したフィールドのみ適用。名前は検索→置換で変更、タグは追加されます。', + 'md.name': '表示名', + 'md.nameFind': '検索', + 'md.nameFindPh': '置換する文字…', + 'md.nameReplace': '置換後', + 'md.nameReplacePh': '置換する文字…', + 'md.nameHint': '「検索」が空なら名前は変更されません。', + 'md.description': '説明', + 'md.descriptionPh': 'このワークフローの用途を一行で…', + 'md.tags': 'タグ', + 'md.tagsPh': '例: 高速, 高品質', + 'md.tagsHint': 'カンマ区切り。一括モードでは追加されます。', + 'md.category': 'カテゴリ', + 'md.modelFamily': 'モデルファミリー', + 'md.apply': '適用', + 'md.applied': '{n} 件を更新しました', + 'md.appliedOne': '更新しました', + 'md.partial': '{n} 件成功、{m} 件失敗', + 'wiz.title': 'ワークフローの一括取り込み', + 'wiz.stepSource': '取り込み元', + 'wiz.stepReport': '事前チェック', + 'wiz.stepResult': '結果', + 'wiz.sourceLabel': '取り込み元', + 'wiz.modeScan': 'サーバーディレクトリをスキャン', + 'wiz.modeFiles': 'ローカルファイルを選択', + 'wiz.rootLabel': 'サーバーディレクトリ', + 'wiz.rootHint': 'サーバー上のディレクトリパス(例: リポジトリの example_ComfyUI_workflows)。UI 形式の JSON を再帰的にスキャンし、API 形式などは自動的にスキップします。', + 'wiz.preflight': '実機 ComfyUI で事前チェック(任意)', + 'wiz.preflightNone': 'スキップ(オフライン変換)', + 'wiz.preflightHint': '接続を選ぶと、変換結果をその ComfyUI のノート・モデルと照合します。', + 'wiz.pickFiles': 'ローカルファイル', + 'wiz.pickFilesBtn': 'JSON ファイルを選択(複数可)', + 'wiz.pickFilesHint': 'ComfyUI UI 形式のワークフロー JSON を選んでください。複数選択できます。', + 'wiz.parsed': '{n} ファイルを読み込みました', + 'wiz.notUi': '{n} ファイルは UI 形式でないため(nodes 配列なし)スキップしました', + 'wiz.noFiles': '先に取り込むファイルを選んでください', + 'wiz.runDry': '事前チェックを実行(保存しません)', + 'wiz.running': 'チェック中…', + 'wiz.total': '全体 {n} ファイル', + 'wiz.ok': '正常 {n}', + 'wiz.warn': '警告 {n}', + 'wiz.fail': '失敗 {n}', + 'wiz.confirmCount': '要確認 {n}', + 'wiz.importable': '取り込み可 {n}', + 'wiz.reportHint': '事前チェックは何も書き込みません。警告は用途を補えば有効な状態で取り込まれ、要確認・失敗のファイルは取り込まれません。', + 'wiz.filterLabel': 'レポートの絞り込み', + 'wiz.filterWarn': '警告のみ', + 'wiz.filterBlocked': '取り込み不可', + 'wiz.searchPh': 'ファイル名を検索…', + 'wiz.includeAria': '{name} を取り込む', + 'wiz.skipReason': '取り込み不可: {reason}', + 'wiz.issues': '変換メモ {n} 件', + 'wiz.usagePick': '用途:', + 'wiz.usageNone': '今はスキップ(取り込み後に要確認)', + 'wiz.selectedN': '{n} ファイルを取り込みます', + 'wiz.excludedM': '{m} 件は取り込み不可', + 'wiz.import': '取り込む', + 'wiz.importing': '取り込み中…', + 'wiz.back': '戻る', + 'wiz.imported': '{n} 件取り込み完了', + 'wiz.skipped': '{n} 件スキップ', + 'wiz.conflict': '既に存在(重複は自動スキップ)', + 'wiz.usageApplied': '新規取り込み {n} 件に用途を設定しました', + 'wiz.done': '完了', + 'wiz.again': '続けて取り込む', + 'wiz.resultNote': '内容が同一のファイルは自動スキップされ、再実行しても重複は作られません。', + 'wiz.importedToast': '{n} 件のワークフローを取り込みました', + 'wiz.warnTag': '警告', + 'wiz.confirmTag': '要確認', + 'wiz.preflightTag': '事前チェック不合格', + 'wiz.importedTag': '取り込み済み #{id}', }; diff --git a/calliope-web/src/lib/i18n/ko.ts b/calliope-web/src/lib/i18n/ko.ts index ea9189fd..d3decc7b 100644 --- a/calliope-web/src/lib/i18n/ko.ts +++ b/calliope-web/src/lib/i18n/ko.ts @@ -2095,4 +2095,136 @@ export const ko: Dict = { 'wfd.nodesPickSuggest': '저장하기 전에 아래에서 용도를 선택하고 출력 매핑을 완료하세요.', 'wfd.showRaw': '원본 JSON 보기', 'wfd.hideRaw': '원본 JSON 접기', + + // --- Workflow library · batch import & management (HEL-682) --- + 'wl.hint': 'UI 형식 워크플로 일괄 가져오기, 검색·필터·주석 관리. 전체 JSON은 작업 시에만 로드', + 'wl.batchImport': '일괄 가져오기', + 'wl.dedupe': '중복 정리', + 'wl.dedupeTitle': '중복 워크플로 삭제', + 'wl.dedupeConfirm': '이름과 내용이 완전히 같은 항목을 삭제합니다(가장 먼저 가져온 것 유지). 이름이 같아도 내용이 다르면 그대로 둡니다. 계속할까요?', + 'wl.dedupeDone': '중복 워크플로 {n}건 삭제', + 'wl.dedupeNone': '중복 워크플로가 없습니다', + 'wl.favCount': '즐겨찾기 {n}건', + 'wl.searchPh': '이름·설명·태그·모델 검색… (/ 키)', + 'wl.filterLabel': '필터', + 'wl.filterAll': '전체', + 'wl.filterFav': '즐겨찾기', + 'wl.filterPending': '확인 필요', + 'wl.filterDisabled': '비활성', + 'wl.favAria': '즐겨찾기 추가', + 'wl.unfavAria': '즐겨찾기 해제', + 'wl.categoryLabel': '분류', + 'wl.categoryAll': '전체 분류', + 'wl.familyLabel': '모델 계열', + 'wl.familyAll': '전체 계열', + 'wl.mediaLabel': '미디어', + 'wl.mediaAll': '전체 미디어', + 'wl.mediaImage': '이미지', + 'wl.mediaVideo': '영상', + 'wl.mediaAudio': '오디오', + 'wl.mediaIn': '입력', + 'wl.mediaOut': '출력', + 'wl.sortLabel': '정렬', + 'wl.sortRecent': '즐겨찾기 / 최근', + 'wl.sortName': '이름', + 'wl.resetFilters': '필터 해제', + 'wl.noMatch': '조건에 맞는 워크플로가 없습니다', + 'wl.resultCount': '{n} / {m}', + 'wl.selected': '{n}건 선택됨', + 'wl.batchLabel': '일괄 작업', + 'wl.batchAnnotate': '일괄 주석', + 'wl.batchEnable': '활성화', + 'wl.batchDisable': '비활성화', + 'wl.clearSel': '선택 해제', + 'wl.batchDone': '{n}건 업데이트', + 'wl.batchPartial': '{n}건 성공, {m}건 실패(용도와 출력 먼저 확정)', + 'wl.selectAll': '나열된 워크플로 모두 선택', + 'wl.rowCheckAria': '{name} 선택', + 'wl.headMeta': '메타데이터', + 'wl.headActions': '작업', + 'wl.enableAria': '{name} 활성화/비활성화', + 'wl.enableBlocked': '활성화 전에 용도와 출력 노드를 확정하세요', + 'wl.editMeta': '메타데이터 편집', + 'wl.lastUsed': '마지막 사용', + 'wl.moreCount': '{n}건 더 보기(전체 {m}건)', + 'wfCat.basic': '기본 처리', + 'wfCat.audioTts': '음성 생성', + 'wfCat.music': '음악 생성', + 'wfCat.image': '이미지 생성', + 'wfCat.video': '영상 생성', + 'wfCat.digitalHuman': '디지털 휴먼', + 'wfCat.motionTransfer': '모션 전이', + 'md.title': '워크플로 주석', + 'md.batchTitle': '일괄 주석({n}건)', + 'md.batchHint': '입력한 필드만 적용됩니다. 이름은 찾기→바꾸기로 변경, 태그는 추가됩니다.', + 'md.name': '표시 이름', + 'md.nameFind': '찾기', + 'md.nameFindPh': '바꿀 문자…', + 'md.nameReplace': '바꾸기', + 'md.nameReplacePh': '대체 문자…', + 'md.nameHint': '「찾기」를 비우면 이름이 유지됩니다.', + 'md.description': '설명', + 'md.descriptionPh': '이 워크플로가 하는 일을 한 줄로…', + 'md.tags': '태그', + 'md.tagsPh': '예: 빠름, 고품질', + 'md.tagsHint': '쉼표로 구분. 일괄 모드에서는 추가됩니다.', + 'md.category': '분류', + 'md.modelFamily': '모델 계열', + 'md.apply': '적용', + 'md.applied': '{n}건 업데이트', + 'md.appliedOne': '업데이트됨', + 'md.partial': '{n}건 성공, {m}건 실패', + 'wiz.title': '워크플로 일괄 가져오기', + 'wiz.stepSource': '원본', + 'wiz.stepReport': '사전 검사', + 'wiz.stepResult': '결과', + 'wiz.sourceLabel': '가져오기 원본', + 'wiz.modeScan': '서버 디렉터리 스캔', + 'wiz.modeFiles': '로컬 파일 선택', + 'wiz.rootLabel': '서버 디렉터리', + 'wiz.rootHint': '서버의 디렉터리 경로(예: 저장소의 example_ComfyUI_workflows). UI 형식 JSON을 재귀적으로 스캔하며 API 형식 등은 건너뜁니다.', + 'wiz.preflight': '실제 ComfyUI 사전 검사(선택)', + 'wiz.preflightNone': '건너뛰기(오프라인 변환)', + 'wiz.preflightHint': '연결을 선택하면 변환 결과를 해당 ComfyUI의 노드·모델과 대조합니다.', + 'wiz.pickFiles': '로컬 파일', + 'wiz.pickFilesBtn': 'JSON 파일 선택(여러 개)', + 'wiz.pickFilesHint': 'ComfyUI UI 형식 워크플로 JSON을 선택하세요. 다중 선택이 가능합니다.', + 'wiz.parsed': '{n}개 파일 읽음', + 'wiz.notUi': '{n}개 파일이 UI 형식이 아니어서(nodes 배열 없음) 건너뛰었습니다', + 'wiz.noFiles': '먼저 가져올 파일을 선택하세요', + 'wiz.runDry': '사전 검사 실행(저장 안 함)', + 'wiz.running': '검사 중…', + 'wiz.total': '총 {n}개 파일', + 'wiz.ok': '정상 {n}', + 'wiz.warn': '경고 {n}', + 'wiz.fail': '실패 {n}', + 'wiz.confirmCount': '확인 필요 {n}', + 'wiz.importable': '가져오기 가능 {n}', + 'wiz.reportHint': '사전 검사는 아무것도 저장하지 않습니다. 경고 항목은 용도를 지정하면 활성화 상태로 가져오며, 확인 필요·실패 항목은 절대 가져오지 않습니다.', + 'wiz.filterLabel': '보고서 필터', + 'wiz.filterWarn': '경고만', + 'wiz.filterBlocked': '가져올 수 없음', + 'wiz.searchPh': '파일 이름 검색…', + 'wiz.includeAria': '{name} 가져오기', + 'wiz.skipReason': '가져올 수 없음: {reason}', + 'wiz.issues': '변환 메모 {n}건', + 'wiz.usagePick': '용도:', + 'wiz.usageNone': '지금은 건너뜀(가져온 뒤 확인 필요)', + 'wiz.selectedN': '{n}개 파일을 가져옵니다', + 'wiz.excludedM': '{m}개 가져올 수 없음', + 'wiz.import': '가져오기', + 'wiz.importing': '가져오는 중…', + 'wiz.back': '이전', + 'wiz.imported': '{n}건 가져옴', + 'wiz.skipped': '{n}건 건너뜀', + 'wiz.conflict': '이미 있음(중복 자동 건너뜀)', + 'wiz.usageApplied': '새로 가져온 {n}건에 용도 지정', + 'wiz.done': '완료', + 'wiz.again': '다시 가져오기', + 'wiz.resultNote': '내용이 같은 파일은 자동으로 건너뛰며, 다시 실행해도 중복이 생기지 않습니다.', + 'wiz.importedToast': '워크플로 {n}건을 가져왔습니다', + 'wiz.warnTag': '경고', + 'wiz.confirmTag': '확인 필요', + 'wiz.preflightTag': '사전 검사 실패', + 'wiz.importedTag': '가져옴 #{id}', }; diff --git a/calliope-web/src/lib/i18n/zh.ts b/calliope-web/src/lib/i18n/zh.ts index ebde95b0..fa72b02e 100644 --- a/calliope-web/src/lib/i18n/zh.ts +++ b/calliope-web/src/lib/i18n/zh.ts @@ -2095,4 +2095,136 @@ export const zh: Dict = { 'wfd.nodesPickSuggest': '请在下方选择用途并完成输出映射后再保存。', 'wfd.showRaw': '查看原始 JSON', 'wfd.hideRaw': '收起原始 JSON', + + // --- Workflow library · batch import & management (HEL-682) --- + 'wl.hint': '批量导入 UI 格式工作流,搜索筛选与标注管理;完整 JSON 只在试运行等操作时按需加载', + 'wl.batchImport': '批量导入', + 'wl.dedupe': '去重', + 'wl.dedupeTitle': '清理重复工作流', + 'wl.dedupeConfirm': '将删除名称与内容完全相同的重复条目(保留最早导入的一条)。同名但内容不同的是你的变体,不会被动。确定执行?', + 'wl.dedupeDone': '已删除 {n} 个重复工作流', + 'wl.dedupeNone': '没有发现重复工作流', + 'wl.favCount': '{n} 个收藏', + 'wl.searchPh': '搜索名称、说明、标签、模型…(按 / 聚焦)', + 'wl.filterLabel': '筛选', + 'wl.filterAll': '全部', + 'wl.filterFav': '收藏', + 'wl.filterPending': '待确认', + 'wl.filterDisabled': '已停用', + 'wl.favAria': '收藏', + 'wl.unfavAria': '取消收藏', + 'wl.categoryLabel': '分类', + 'wl.categoryAll': '全部分类', + 'wl.familyLabel': '模型家族', + 'wl.familyAll': '全部模型', + 'wl.mediaLabel': '媒介', + 'wl.mediaAll': '全部媒介', + 'wl.mediaImage': '图像', + 'wl.mediaVideo': '视频', + 'wl.mediaAudio': '音频', + 'wl.mediaIn': '输入', + 'wl.mediaOut': '输出', + 'wl.sortLabel': '排序', + 'wl.sortRecent': '收藏 / 最近使用', + 'wl.sortName': '名称', + 'wl.resetFilters': '清除筛选', + 'wl.noMatch': '没有符合条件的工作流', + 'wl.resultCount': '匹配 {n} / {m}', + 'wl.selected': '已选 {n} 项', + 'wl.batchLabel': '批量操作', + 'wl.batchAnnotate': '批量标注', + 'wl.batchEnable': '启用', + 'wl.batchDisable': '停用', + 'wl.clearSel': '清除选择', + 'wl.batchDone': '已更新 {n} 项', + 'wl.batchPartial': '{n} 项成功,{m} 项失败(需先确认用途与输出映射)', + 'wl.selectAll': '选择当前列出的全部工作流', + 'wl.rowCheckAria': '选择 {name}', + 'wl.headMeta': '标注', + 'wl.headActions': '操作', + 'wl.enableAria': '启用或停用 {name}', + 'wl.enableBlocked': '需先确认用途并指定输出节点,才能启用', + 'wl.editMeta': '编辑标注', + 'wl.lastUsed': '最近使用', + 'wl.moreCount': '再显示 {n} 项(共 {m} 项)', + 'wfCat.basic': '基础处理', + 'wfCat.audioTts': '语音生成', + 'wfCat.music': '音乐生成', + 'wfCat.image': '图像生成', + 'wfCat.video': '视频生成', + 'wfCat.digitalHuman': '数字人', + 'wfCat.motionTransfer': '动作迁移', + 'md.title': '标注工作流', + 'md.batchTitle': '批量标注({n} 项)', + 'md.batchHint': '只有填写了的字段会被应用;显示名按「查找→替换」批量重命名,标签为追加。', + 'md.name': '显示名', + 'md.nameFind': '查找', + 'md.nameFindPh': '要替换的文字…', + 'md.nameReplace': '替换为', + 'md.nameReplacePh': '替换后的文字…', + 'md.nameHint': '留空「查找」则不改名。', + 'md.description': '说明', + 'md.descriptionPh': '一句话说明这个工作流做什么…', + 'md.tags': '标签', + 'md.tagsPh': '如:快速, 高质量', + 'md.tagsHint': '用逗号分隔;批量模式下为追加标签。', + 'md.category': '分类', + 'md.modelFamily': '模型家族', + 'md.apply': '应用', + 'md.applied': '已更新 {n} 项', + 'md.appliedOne': '已更新', + 'md.partial': '{n} 项成功,{m} 项失败', + 'wiz.title': '批量导入工作流', + 'wiz.stepSource': '选择来源', + 'wiz.stepReport': '预检报告', + 'wiz.stepResult': '导入结果', + 'wiz.sourceLabel': '导入来源', + 'wiz.modeScan': '扫描服务器目录', + 'wiz.modeFiles': '选择本地文件', + 'wiz.rootLabel': '服务器目录', + 'wiz.rootHint': '服务器上的目录路径(如仓库的 example_ComfyUI_workflows),将递归扫描其中的 ComfyUI 界面格式 JSON;API 格式与其他 JSON 自动跳过。', + 'wiz.preflight': '对真实 ComfyUI 预检(可选)', + 'wiz.preflightNone': '跳过(离线转换)', + 'wiz.preflightHint': '选择连接后,转换结果会对照该 ComfyUI 的节点与模型做对象级检查。', + 'wiz.pickFiles': '本地文件', + 'wiz.pickFilesBtn': '选择 JSON 文件(可多选)', + 'wiz.pickFilesHint': '选择 ComfyUI 界面格式(UI 格式)的工作流 JSON,可一次选多个。', + 'wiz.parsed': '已读取 {n} 个文件', + 'wiz.notUi': '{n} 个文件不是 UI 格式(缺少 nodes 数组),已忽略', + 'wiz.noFiles': '请先选择要导入的文件', + 'wiz.runDry': '开始预检(不写入)', + 'wiz.running': '预检中…', + 'wiz.total': '共 {n} 个文件', + 'wiz.ok': '正常 {n}', + 'wiz.warn': '警告 {n}', + 'wiz.fail': '失败 {n}', + 'wiz.confirmCount': '需人工确认 {n}', + 'wiz.importable': '可导入 {n}', + 'wiz.reportHint': '预检不写入数据库。warn 项可补充用途后以启用状态导入;「需人工确认」与转换失败项不会被导入,也不会被标为可运行。', + 'wiz.filterLabel': '报告筛选', + 'wiz.filterWarn': '仅看警告', + 'wiz.filterBlocked': '不可导入', + 'wiz.searchPh': '搜索文件名…', + 'wiz.includeAria': '导入 {name}', + 'wiz.skipReason': '不可导入:{reason}', + 'wiz.issues': '{n} 条转换提示', + 'wiz.usagePick': '补充用途:', + 'wiz.usageNone': '暂不补充(导入后待确认)', + 'wiz.selectedN': '将导入 {n} 个文件', + 'wiz.excludedM': '{m} 个不可导入', + 'wiz.import': '确认导入', + 'wiz.importing': '导入中…', + 'wiz.back': '上一步', + 'wiz.imported': '导入成功 {n}', + 'wiz.skipped': '跳过 {n}', + 'wiz.conflict': '已存在(重复导入自动跳过)', + 'wiz.usageApplied': '已为 {n} 个新导入项补充用途', + 'wiz.done': '完成', + 'wiz.again': '再导一批', + 'wiz.resultNote': '内容相同的重复文件会被自动跳过,重复执行不会产生重复条目。', + 'wiz.importedToast': '已导入 {n} 个工作流', + 'wiz.warnTag': '警告', + 'wiz.confirmTag': '需人工确认', + 'wiz.preflightTag': '预检未通过', + 'wiz.importedTag': '已导入 #{id}', }; diff --git a/calliope-web/src/routes/connections/+page.svelte b/calliope-web/src/routes/connections/+page.svelte index d8338c97..c1ee8460 100644 --- a/calliope-web/src/routes/connections/+page.svelte +++ b/calliope-web/src/routes/connections/+page.svelte @@ -7,10 +7,8 @@ import ConfirmDialog from '$lib/components/ui/ConfirmDialog.svelte'; import Icon from '$lib/components/ui/Icon.svelte'; import EmptyState from '$lib/components/ui/EmptyState.svelte'; - import WorkflowImportDrawer from '$lib/components/WorkflowImportDrawer.svelte'; - import WorkflowTestDialog from '$lib/components/WorkflowTestDialog.svelte'; - import { apiErrorMessage, comfy, settings, workflows, type ComfyEndpoint, type Workflow, type WorkflowOutputMapEntry, type WorkflowUsage, type WorkflowConnectionCheck } from '$lib/api'; - import { WORKFLOW_USAGES } from '$lib/comfy/types'; + import WorkflowLibrary from '$lib/components/workflows/WorkflowLibrary.svelte'; + import { apiErrorMessage, comfy, settings, workflows, type ComfyEndpoint, type WorkflowMeta } from '$lib/api'; import { toast } from '$lib/toast'; import { t } from '$lib/i18n.svelte'; import { classifyEndpoint, endpointTypeLabel, type EndpointKind } from '$lib/endpointKind'; @@ -25,12 +23,17 @@ queryKey: ['settings'], queryFn: settings.get, }); - const workflowsQuery = createQuery({ - queryKey: ['workflows'], - queryFn: workflows.list, + // HEL-682: the library browses metadata only (view=meta) — the heavy + // workflow_json payloads are fetched per-row inside WorkflowLibrary + // exactly when an action needs them. + const wfMetaQuery = createQuery({ + queryKey: ['workflows', 'meta'], + queryFn: workflows.listMeta, }); - const endpoints = $derived($settingsQuery.data?.comfyui_endpoints ?? []); + const endpoints = $derived( + $settingsQuery.data?.comfyui_endpoints ?? [], + ); const activeId = $derived( $settingsQuery.data?.comfyui_active_id ?? endpoints[0]?.id ?? '', ); @@ -281,7 +284,7 @@ } function workflowsBound(id: string): number { - return ($workflowsQuery.data ?? []).filter((wf) => wf.endpoint_id === id).length; + return ($wfMetaQuery.data ?? []).filter((wf) => wf.endpoint_id === id).length; } const deleteMessage = $derived.by(() => { @@ -327,188 +330,6 @@ }, }); - // ------------------------------------------------------------------ - // Workflow library (binding + per-row recheck / test). The import - // wizard itself lives in WorkflowImportDrawer (HEL-655 E 批). - // ------------------------------------------------------------------ - let wfImportOpen = $state(false); - - function startWfImport() { - wfImportOpen = true; - } - - function usageLabel(u: WorkflowUsage | null | undefined): string { - return u ? t(`usage.${u}`) : t('usage.pending'); - } - - function wfProblems(wf: Workflow): string[] { - return (wf.warnings ?? []).filter((w) => w.level === 'error').map((w) => w.message); - } - - // HEL-643 L2: per-row 重新检查 / 测试 in the workflow library. - let wfRecheckId = $state(null); - const wfRecheckResult = $state>({}); - - async function recheckRow(wf: Workflow) { - wfRecheckId = wf.id; - try { - const res = await workflows.check(wf.id, { refresh: true }); - wfRecheckResult[wf.id] = res; - } catch (err) { - toast.error(apiErrorMessage(err)); - } finally { - wfRecheckId = null; - } - } - - function recheckLine(wf: Workflow): { tone: 'ok' | 'bad' | 'warn'; text: string } | null { - const check = wfRecheckResult[wf.id]; - if (!check) return null; - if (!check.reachable) return { tone: 'warn', text: t('conn.wfCheckUnreachable') }; - if (check.ok) return { tone: 'ok', text: t('conn.wfCheckOk') }; - const n = check.findings.length; - return { tone: 'bad', text: t('conn.wfCheckProblems', { n }) }; - } - - let testWf = $state(null); - let testOpen = $state(false); - - function openTest(wf: Workflow) { - testWf = wf; - testOpen = true; - } - - function lastTestLine(wf: Workflow): string | null { - const lt = wf.last_test; - if (!lt) return null; - if (lt.status === 'done' && lt.output_count > 0) { - return t('conn.wfTestPassed', { n: lt.output_count, time: formatDbTime(lt.completed_at ?? lt.created_at) }); - } - if (lt.status === 'pending' || lt.status === 'running') { - return t('conn.wfTestRunning', { time: formatDbTime(lt.created_at) }); - } - return t('conn.wfTestFailed', { time: formatDbTime(lt.completed_at ?? lt.created_at) }); - } - - function formatDbTime(at: string | null): string { - if (!at) return '—'; - const ts = Date.parse(at.replace(' ', 'T') + 'Z'); - const d = new Date(Number.isFinite(ts) ? ts : at); - if (Number.isNaN(d.getTime())) return '—'; - const p = (n: number) => String(n).padStart(2, '0'); - return `${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`; - } - - const wfConfirmMutation = createMutation({ - mutationFn: ({ id, usage }: { id: number; usage: WorkflowUsage }) => - workflows.update(id, { usage, usage_source: 'user' }), - onSuccess: (wf) => { - client.invalidateQueries({ queryKey: ['workflows'] }); - toast.success(t('conn.wfConfirmed', { usage: usageLabel(wf.usage) })); - }, - onError: (err) => { - toast.error( - t('conn.wfImportFailed', { - detail: err instanceof Error ? err.message : String(err), - }), - ); - }, - }); - - // ------------------------------------------------------------------ - // HEL-638: per-row output-node designation for pending workflows with - // unknown custom output nodes (imported earlier or parked by migration). - // ------------------------------------------------------------------ - let wfMapEditId = $state(null); - let wfMapPicked = $state>({}); - let wfMapKind = $state>({}); - - function rowOutputCandidates(wf: Workflow) { - return (wf.output_schema ?? []).filter((o) => o.evidence === 'unknown_node'); - } - - function rowNeedsOutputMap(wf: Workflow): boolean { - return Boolean(wf.needs_mapping) && !(wf.output_map ?? []).length; - } - - function toggleWfMapEdit(wf: Workflow) { - if (wfMapEditId === wf.id) { - wfMapEditId = null; - return; - } - const picked: Record = {}; - const kinds: Record = {}; - const mapped = new Map((wf.output_map ?? []).map((e) => [e.nodeId, e.kind])); - for (const c of rowOutputCandidates(wf)) { - const known = mapped.get(c.nodeId); - if (known) picked[c.nodeId] = true; - kinds[c.nodeId] = known ?? c.suggested_kind ?? 'image'; - } - wfMapPicked = picked; - wfMapKind = kinds; - wfMapEditId = wf.id; - } - - const wfMapMutation = createMutation({ - mutationFn: ({ id, outputMap }: { id: number; outputMap: WorkflowOutputMapEntry[] }) => - workflows.update( - id, - outputMap.length - ? { output_map: outputMap, output_map_source: 'user' } - : { output_map: [] }, - ), - onSuccess: (wf) => { - client.invalidateQueries({ queryKey: ['workflows'] }); - wfMapEditId = null; - const nodes = (wf.output_map ?? []).map((e) => e.nodeId).join('、'); - toast.success( - wf.output_map?.length - ? t('conn.wfOutputApplied', { nodes }) - : t('conn.wfOutputCleared'), - ); - }, - onError: (err) => { - toast.error( - t('conn.wfImportFailed', { - detail: err instanceof Error ? err.message : String(err), - }), - ); - }, - }); - - function submitWfMap(wf: Workflow) { - if ($wfMapMutation.isPending) return; - const outputMap = rowOutputCandidates(wf) - .filter((c) => wfMapPicked[c.nodeId]) - .map((c) => ({ - nodeId: c.nodeId, - kind: wfMapKind[c.nodeId] ?? c.suggested_kind ?? 'image', - label: c.label, - ...(c.class_type ? { class_type: c.class_type } : {}), - })); - $wfMapMutation.mutate({ id: wf.id, outputMap }); - } - - const wfBindMutation = createMutation({ - mutationFn: ({ id, endpointId }: { id: number; endpointId: string | null }) => - workflows.update(id, { endpoint_id: endpointId }), - onSuccess: () => { - client.invalidateQueries({ queryKey: ['workflows'] }); - }, - }); - - const wfDeleteMutation = createMutation({ - mutationFn: (id: number) => workflows.delete(id), - onSuccess: () => { - client.invalidateQueries({ queryKey: ['workflows'] }); - toast.success(t('conn.wfDeleted')); - }, - onError: (err) => { - // e.g. 409 "该工作流还有 N 个排队或执行中的任务…" (HEL-619) - toast.error(apiErrorMessage(err)); - }, - }); - // ------------------------------------------------------------------ // Helpers // ------------------------------------------------------------------ @@ -529,7 +350,9 @@ // 任务使用目标 (a6): where each kind of job actually runs — a workflow's // own binding first, otherwise the default connection. function kindTarget(kind: 'image' | 'video' | null): { value: string; kind: EndpointKind | null } { - const wfs = ($workflowsQuery.data ?? []).filter((w) => kind === null || w.kind === kind); + const wfs: WorkflowMeta[] = ($wfMetaQuery.data ?? []).filter( + (w) => kind === null || w.kind === kind, + ); const ids = new Set(wfs.map((w) => w.endpoint_id || activeId).filter(Boolean)); if (wfs.length === 0) ids.add(activeId); if (ids.size === 1) { @@ -710,208 +533,7 @@

- -
-
-

{t('conn.wfTitle')}

- {t('conn.wfHint')} - - - -
- - {#if ($workflowsQuery.data ?? []).length === 0} - -

{t('conn.missingMaterial')}

- {:else} - {@const wfs = $workflowsQuery.data ?? []} - {@const pending = wfs.filter((w) => !w.usage).length} -

- {t('conn.wfCount', { - n: wfs.length, - m: wfs.filter((w) => w.kind === 'image').length, - k: wfs.filter((w) => w.kind === 'video').length, - })} - {#if pending} - · {t('conn.wfPendingCount', { n: pending })} - {/if} -

-
- {#each wfs as wf (wf.id)} -
- - - - {wf.name} - {#if wf.usage} - - {usageLabel(wf.usage)} - - {:else} - - {/if} - {#if rowNeedsOutputMap(wf)} - - {/if} - {#if !wf.is_enabled && wf.usage && !rowNeedsOutputMap(wf)} - {t('conn.wfDisabledBadge')} - {/if} - {#if wfProblems(wf).length} - - {t('conn.wfBrokenBadge')} - - {/if} - {t('conn.wfParams', { n: wf.input_schema?.length ?? 0 })} - - - - -
- {@const lastLine = lastTestLine(wf)} - {@const recheck = recheckLine(wf)} - {#if lastLine || recheck} -
- {#if lastLine}{t('conn.wfLastTest')}:{lastLine}{/if} - {#if recheck} - - {#if recheck.tone === 'bad'} - {@const check = wfRecheckResult[wf.id]} - f.message).join('\n')}> - {recheck.text} - - {:else} - {recheck.text} - {/if} - - {/if} -
- {/if} - {#if wfMapEditId === wf.id} -
-

{t('conn.wfOutputHint')}

-
- {#each rowOutputCandidates(wf) as c (c.nodeId)} -
- - -
- {/each} -
-
- - -
-
- {/if} - {/each} -
- {/if} -
+ {#if formMode !== 'idle'} @@ -1104,17 +726,6 @@ {/if} - client.invalidateQueries({ queryKey: ['workflows'] })} - /> - client.invalidateQueries({ queryKey: ['workflows'] })} - /> diff --git a/docs/changelogs/2026-10-11-hel682-s4-workflow-import-admin.md b/docs/changelogs/2026-10-11-hel682-s4-workflow-import-admin.md new file mode 100644 index 00000000..ba36df50 --- /dev/null +++ b/docs/changelogs/2026-10-11-hel682-s4-workflow-import-admin.md @@ -0,0 +1,40 @@ +# S4:工作流批量导入向导与管理页(HEL-682) + +复用 `/connections` 工作流库,接入 S2(HEL-681)的数据层端点:批量导入向导 + +元数据轻量管理列表。本批只动 `calliope-web`,后端零改动。 + +## 批量导入向导(`WorkflowBatchImportWizard.svelte`) + +- 三步式抽屉(780px):选择来源 → 预检报告 → 导入结果。 +- 来源两种:扫描服务器目录(`POST /api/workflows/import-scan`,默认 + `example_ComfyUI_workflows`,可选对真实 ComfyUI 做 L2 预检)或本地多选 + 文件(客户端解析,非 UI 格式自动忽略,`POST /api/workflows/convert`)。 +- 预检报告逐文件给出 ok/warn/fail、转换提示、建议元数据(用途/分类/模型 + 家族/输入输出媒介);warn 项可就地补充用途(目录模式在导入后 PATCH 到 + 新行);「需人工确认」与转换失败项不可勾选、不会被导入、永远不被标作 + 可运行。 +- 重复导入按内容去重:重复执行全部 conflict 跳过,界面明示「已存在」。 + +## 管理列表改元数据驱动(`WorkflowLibrary.svelte`,自 connections 页抽出) + +- 列表数据源换成 `GET /api/workflows?view=meta`(无 workflow_json / + input_schema,152 条约 90KB),完整 JSON 只在试运行、输出指定等操作时 + 按需单条加载并缓存。 +- 工具栏:搜索(`/` 聚焦)、类型/收藏/待确认/停用筛选、分类/模型家族/ + 媒介下拉、收藏/最近与名称排序、清除筛选;行内:分类与模型家族标签、 + 输入→输出媒介图标、收藏星标、启停开关(用途/输出未 settle 时禁用并 + 提示)、试运行(复用 `WorkflowTestDialog`)、L2 复查、绑定连接、删除; + 分页渲染(60/批,「再显示」)。 +- 批量:勾选 + 全选 → 批量标注(查找替换重命名、统一说明、追加标签、 + 分类/模型家族)与批量启停。 +- 新增去重入口(`POST /api/workflows/dedupe`,字节级相同才删,保留最早)。 +- 原有能力保留:用途确认下拉、输出节点指定(HEL-638)、单个 API 格式 + 导入抽屉(HEL-655)。 + +## 其他 + +- `api.ts`/`comfy/types.ts`:`listMeta/convert/importBatch/importScanDry/ + importScanCommit/touch/dedupe` 客户端与 `WorkflowMeta` 等类型;`update` + 载荷支持 favorite/tags/category/model_family。 +- i18n:`wl.* / md.* / wiz.* / wfCat.*` 共 130 键 × 7 语言;分类展示用 + 标签映射,不把 30 字目录名暴露给用户。