Skip to content
Python

Plantillas: el prompt se escribe aunque "Extra direction" vaya vacío

neuregexb7e6b6ed4baf
diff --git a/apps/billboard/app.json b/apps/billboard/app.json
index cff03b7..e4a50ed 100644
--- a/apps/billboard/app.json
+++ b/apps/billboard/app.json
@@ -53,6 +53,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/breakdown/app.json b/apps/breakdown/app.json
index f05a86c..c150081 100644
--- a/apps/breakdown/app.json
+++ b/apps/breakdown/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/brick-toy/app.json b/apps/brick-toy/app.json
index 631059f..370f2fb 100644
--- a/apps/brick-toy/app.json
+++ b/apps/brick-toy/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/burning-sunset/app.json b/apps/burning-sunset/app.json
index 7ddd1ee..4b5740f 100644
--- a/apps/burning-sunset/app.json
+++ b/apps/burning-sunset/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/cafe-60s/app.json b/apps/cafe-60s/app.json
index 5fc648d..5bb54ca 100644
--- a/apps/cafe-60s/app.json
+++ b/apps/cafe-60s/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/color-grade/app.json b/apps/color-grade/app.json
index 0d2a8fb..209ad13 100644
--- a/apps/color-grade/app.json
+++ b/apps/color-grade/app.json
@@ -65,6 +65,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/comic-book/app.json b/apps/comic-book/app.json
index 597ccd2..2d1fc67 100644
--- a/apps/comic-book/app.json
+++ b/apps/comic-book/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/commercial-faces/app.json b/apps/commercial-faces/app.json
index 2012ccb..d35433b 100644
--- a/apps/commercial-faces/app.json
+++ b/apps/commercial-faces/app.json
@@ -57,6 +57,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/edit-text/app.json b/apps/edit-text/app.json
index 748ca0b..3795f71 100644
--- a/apps/edit-text/app.json
+++ b/apps/edit-text/app.json
@@ -47,6 +47,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/figure-3d/app.json b/apps/figure-3d/app.json
index 1fac8c2..27f91d3 100644
--- a/apps/figure-3d/app.json
+++ b/apps/figure-3d/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/fridge-ad/app.json b/apps/fridge-ad/app.json
index 56d8382..1b20bbb 100644
--- a/apps/fridge-ad/app.json
+++ b/apps/fridge-ad/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/game-styles/app.json b/apps/game-styles/app.json
index e5ea3ea..bc488d8 100644
--- a/apps/game-styles/app.json
+++ b/apps/game-styles/app.json
@@ -89,6 +89,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/giallo/app.json b/apps/giallo/app.json
index 67278d6..d1cf069 100644
--- a/apps/giallo/app.json
+++ b/apps/giallo/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/giant-product/app.json b/apps/giant-product/app.json
index 97b87b4..2ae77e0 100644
--- a/apps/giant-product/app.json
+++ b/apps/giant-product/app.json
@@ -53,6 +53,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/glitter-sticker/app.json b/apps/glitter-sticker/app.json
index 6434428..c02f3da 100644
--- a/apps/glitter-sticker/app.json
+++ b/apps/glitter-sticker/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/graffiti-ad/app.json b/apps/graffiti-ad/app.json
index 3eb1f5b..ee19ee8 100644
--- a/apps/graffiti-ad/app.json
+++ b/apps/graffiti-ad/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/headshot/app.json b/apps/headshot/app.json
index c1bbae6..c0283d3 100644
--- a/apps/headshot/app.json
+++ b/apps/headshot/app.json
@@ -81,6 +81,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/image-effects/app.json b/apps/image-effects/app.json
index af93802..9f55218 100644
--- a/apps/image-effects/app.json
+++ b/apps/image-effects/app.json
@@ -81,6 +81,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/j-magazine/app.json b/apps/j-magazine/app.json
index 2a93708..64667cf 100644
--- a/apps/j-magazine/app.json
+++ b/apps/j-magazine/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/j-poster/app.json b/apps/j-poster/app.json
index 467f39b..7422660 100644
--- a/apps/j-poster/app.json
+++ b/apps/j-poster/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/japanese-show/app.json b/apps/japanese-show/app.json
index 7bb63e6..0dc70c3 100644
--- a/apps/japanese-show/app.json
+++ b/apps/japanese-show/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/macro-product/app.json b/apps/macro-product/app.json
index b67d17c..9eb38a0 100644
--- a/apps/macro-product/app.json
+++ b/apps/macro-product/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/macro-scene/app.json b/apps/macro-scene/app.json
index ab83a98..2c113c5 100644
--- a/apps/macro-scene/app.json
+++ b/apps/macro-scene/app.json
@@ -57,6 +57,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/mascot/app.json b/apps/mascot/app.json
index e5d34c3..d58ea3d 100644
--- a/apps/mascot/app.json
+++ b/apps/mascot/app.json
@@ -57,6 +57,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/meme/app.json b/apps/meme/app.json
index ac4be64..4da5964 100644
--- a/apps/meme/app.json
+++ b/apps/meme/app.json
@@ -39,6 +39,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/micro-beasts/app.json b/apps/micro-beasts/app.json
index 5799206..d9eb767 100644
--- a/apps/micro-beasts/app.json
+++ b/apps/micro-beasts/app.json
@@ -57,6 +57,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/mural/app.json b/apps/mural/app.json
index 835c5dd..9f763fc 100644
--- a/apps/mural/app.json
+++ b/apps/mural/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/outfit-vending/app.json b/apps/outfit-vending/app.json
index 073cb5a..cd9e20e 100644
--- a/apps/outfit-vending/app.json
+++ b/apps/outfit-vending/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/packshot/app.json b/apps/packshot/app.json
index 4c2ccbd..cadfaea 100644
--- a/apps/packshot/app.json
+++ b/apps/packshot/app.json
@@ -57,6 +57,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/paint-app/app.json b/apps/paint-app/app.json
index 6893180..6266975 100644
--- a/apps/paint-app/app.json
+++ b/apps/paint-app/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/pixel-game/app.json b/apps/pixel-game/app.json
index bcaae30..9c8e300 100644
--- a/apps/pixel-game/app.json
+++ b/apps/pixel-game/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/plushie/app.json b/apps/plushie/app.json
index fa50d7a..ca7f0c9 100644
--- a/apps/plushie/app.json
+++ b/apps/plushie/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/poster/app.json b/apps/poster/app.json
index 44f37b0..05264c9 100644
--- a/apps/poster/app.json
+++ b/apps/poster/app.json
@@ -40,6 +40,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/renaissance/app.json b/apps/renaissance/app.json
index 493ee16..4f69679 100644
--- a/apps/renaissance/app.json
+++ b/apps/renaissance/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/render-3d/app.json b/apps/render-3d/app.json
index bd8b99b..4ea1316 100644
--- a/apps/render-3d/app.json
+++ b/apps/render-3d/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/sketch-to-real/app.json b/apps/sketch-to-real/app.json
index b198445..c8cc028 100644
--- a/apps/sketch-to-real/app.json
+++ b/apps/sketch-to-real/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/skin-enhancer/app.json b/apps/skin-enhancer/app.json
index 8dbd7ba..c07c1de 100644
--- a/apps/skin-enhancer/app.json
+++ b/apps/skin-enhancer/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/style-snap/app.json b/apps/style-snap/app.json
index 81bbf0d..e8ae5a9 100644
--- a/apps/style-snap/app.json
+++ b/apps/style-snap/app.json
@@ -65,6 +65,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/ugc-shot/app.json b/apps/ugc-shot/app.json
index 4c62525..bb5b861 100644
--- a/apps/ugc-shot/app.json
+++ b/apps/ugc-shot/app.json
@@ -53,6 +53,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/apps/victory-card/app.json b/apps/victory-card/app.json
index d2bac8e..8bd2c87 100644
--- a/apps/victory-card/app.json
+++ b/apps/victory-card/app.json
@@ -33,6 +33,7 @@
"id": "details",
"type": "textarea",
"label": "Extra direction",
+ "default": "",
"help": "Added at the end of the app's prompt.",
"bind": [
{
diff --git a/server/registry.ts b/server/registry.ts
index ff3af60..ccf89aa 100644
--- a/server/registry.ts
+++ b/server/registry.ts
@@ -111,6 +111,9 @@ function checkGraph(app: App, problems: Problem[], severity: Problem["severity"]
has(b.node, b.field, `input "${input.id}"`);
if (b.template) checkTemplate(b.template, `input "${input.id}"`);
if (isFileInput(input) && b.template) say(`input "${input.id}": file inputs cannot use templates`);
+ // an optional input with no default is skipped when left empty, and its template with it: the node keeps the
+ // workflow's own text (the 40 template apps' prompts were lost this way in their first lab run)
+ if (b.template && !input.required && input.default === undefined) say(`input "${input.id}": its bind template is only written when the input has a value; give it a default ("" is fine)`);
}
// string values an option writes may be templates too (an effect's prompt written around {subject})
for (const o of input.options ?? []) {
diff --git a/test/runner.test.ts b/test/runner.test.ts
index a2f06bc..42cc2d6 100644
--- a/test/runner.test.ts
+++ b/test/runner.test.ts
@@ -88,6 +88,19 @@ test("an option's string values are templates: the effect's prompt is written ar
assert.equal(extra.sets["3.steps"], 6);
});
+test("a template app writes its prompt even when Extra direction is left empty", () => {
+ const app = byId("headshot");
+ const file = { bytes: new Uint8Array([1]), name: "me.png" };
+ const wf = recorder();
+ applyInputs(app, resolveValues(app, { image: file, seed: 1 }), wf, () => null);
+ const text = wf.sets["4.text"] as string;
+ assert.match(text, /^A professional studio headshot of the same person as in <ref_image_0>, plain light grey backdrop, wearing a navy blazer/);
+ assert.match(text, /build identical\.$/, "nothing dangles after the prompt");
+ const more = recorder();
+ applyInputs(app, resolveValues(app, { image: file, backdrop: "dark charcoal backdrop", details: "slight smile", seed: 1 }), more, () => null);
+ assert.match(more.sets["4.text"] as string, /, dark charcoal backdrop, .*identical\. slight smile$/);
+});
+
test("every effect writes its own LoRA and a prompt with its trigger words", () => {
const app = byId("effects");
const effect = app.inputs.find((i) => i.id === "effect")!;
diff --git a/tools/template_apps.py b/tools/template_apps.py
index 1e3414a..80db5c2 100644
--- a/tools/template_apps.py
+++ b/tools/template_apps.py
@@ -319,7 +319,8 @@ def manifest(t: dict) -> dict:
inputs.append({"id": "image", "type": "image", "label": t["image_label"], "required": True, "limits": {"max_mb": 20},
"bind": [{"node": base["image"][0], "field": base["image"][1]}]})
inputs += t["inputs"]
- inputs.append({"id": "details", "type": "textarea", "label": "Extra direction", "help": "Added at the end of the app's prompt.",
+ # the default "" matters: an optional input with no value is skipped everywhere, and the template with it
+ inputs.append({"id": "details", "type": "textarea", "label": "Extra direction", "default": "", "help": "Added at the end of the app's prompt.",
"bind": [{"node": base["prompt"][0], "field": base["prompt"][1], "template": t["prompt"] + " {details}"}]})
inputs += [keep[k] for k in base["keep"]]
test = {"image": "test/portrait.png"} if base["image"] else {}