Say a prompt's role for values kept from pictures

Current node showed "negative prompt" only on values from a workflow. A material's blocks carried no role, and when a picture and a workflow held the same text the merged card kept the picture's empty one, so a negative prompt could be offered to a positive box with nothing to say so.

- api/materials.py works the role out by what the prompt was wired to, as the material details already do; it reads the stored workflow, so pictures kept earlier get it too.
- node_parameter_sets.js takes the role from whichever source knows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DemonGatanjieu
2026-11-06 16:54:43 +08:00
co-authored by Claude Opus 5.5
parent ec81f8b230
commit f5a3b5f9ff
5 changed files with 38 additions and 0 deletions
+3
View File
@@ -26,6 +26,8 @@ async function fetchJson(url, signal) {
return response.json();
}
const KNOWN_ROLES = new Set(['positive', 'negative', 'both']);
/**
* [{ name, role, timestamp, values, sources }], newest first. A source is a material
* { kind: 'material', label, filename, timestamp, origin, image, preview } (origin: how it was
@@ -51,6 +53,7 @@ export async function loadParameterSets(type, { signal, boxes = [] } = {}) {
else {
known.sources.push(...entry.sources);
known.timestamp = Math.max(known.timestamp, entry.timestamp);
if (!KNOWN_ROLES.has(known.role)) known.role = entry.role; // one source may not know it
}
};
for (const material of materials.materials || []) {