From db00cbf06e5342547639004eedd72ae5bf972c5b Mon Sep 17 00:00:00 2001 From: Robin Fernandes Date: Fri, 27 Oct 2023 13:41:16 +1100 Subject: [PATCH] Add support for templated common prompt --- src/Deforum.test.tsx | 85 + src/ParseqUI.d.ts | 2 +- src/__snapshots__/Deforum.test.tsx.snap | 9573 ++++++++++++----------- src/components/Prompts.tsx | 25 +- src/parseq-renderer.ts | 21 +- 5 files changed, 5065 insertions(+), 4641 deletions(-) diff --git a/src/Deforum.test.tsx b/src/Deforum.test.tsx index b03391b..00b7b15 100644 --- a/src/Deforum.test.tsx +++ b/src/Deforum.test.tsx @@ -9400,4 +9400,89 @@ test('Cadence', async () => { }; await loadAndRender(fixture); expect(screen.getByTestId("output")).toMatchSnapshot(); +}); + + +test('Common prompt template', async () => { + const fixture = { + "prompts": { + "format": "v2", + "enabled": true, + "commonPrompt": { + "name": "Common", + "positive": "a [prompt] b c", + "negative": "", + "allFrames": true, + "from": 0, + "to": 119, + "overlap": { + "inFrames": 0, + "outFrames": 0, + "type": "none", + "custom": "prompt_weight_1" + } + }, + "commonPromptPos": "template", + "promptList": [ + { + "name": "Prompt 1", + "positive": "A lone (black cat:${prompt_weight_1})", + "negative": "(black cat:${prompt_weight_2})", + "allFrames": false, + "from": 0, + "to": 15, + "overlap": { + "inFrames": 0, + "outFrames": 5, + "type": "linear", + "custom": "prompt_weight_1" + } + }, + { + "positive": "A lone (black duck:${prompt_weight_1})", + "negative": "nothing", + "from": 10, + "to": 20, + "allFrames": false, + "name": "Prompt 2", + "overlap": { + "inFrames": 5, + "outFrames": 0, + "type": "linear", + "custom": "prompt_weight_2" + } + } + ] + }, + "options": { + "bpm": 140, + "output_fps": 20, + "cadence": 1 + }, + "managedFields": [ + "prompt_weight_1", + "prompt_weight_2", + ], + "displayedFields": [ + "prompt_weight_1", + "prompt_weight_2", + ], + "keyframes": [ + { + "frame": 0, + "prompt_weight_1": 1, + "prompt_weight_1_i": "bez(0,0.6,1,0.4)", + "prompt_weight_2": 0, + "prompt_weight_2_i": "bez(0,0.6,1,0.4)" + }, + { + "frame": 20, + "prompt_weight_1": 0, + "prompt_weight_2": 1 + } + ], + + }; + await loadAndRender(fixture); + expect(screen.getByTestId("output")).toMatchSnapshot(); }); \ No newline at end of file diff --git a/src/ParseqUI.d.ts b/src/ParseqUI.d.ts index 32317f8..bbab9c0 100644 --- a/src/ParseqUI.d.ts +++ b/src/ParseqUI.d.ts @@ -116,7 +116,7 @@ type AdvancedParseqPromptsV2 = { enabled: boolean; promptList: AdvancedParseqPrompt[] | []; commonPrompt: AdvancedParseqPrompt; - commonPromptPos: "append" | "prepend" + commonPromptPos: "append" | "prepend"| "template" } type ParseqPrompts = SimpleParseqPrompts | AdvancedParseqPrompts | AdvancedParseqPromptsV2; diff --git a/src/__snapshots__/Deforum.test.tsx.snap b/src/__snapshots__/Deforum.test.tsx.snap index ebdb810..0b6fa42 100644 --- a/src/__snapshots__/Deforum.test.tsx.snap +++ b/src/__snapshots__/Deforum.test.tsx.snap @@ -189,19 +189,19 @@ exports[`Blank document 1`] = ` "redo_flow_factor": 1, "cn_1_weight": 1, "cn_1_guidance_start": 0, - "cn_1_guidance_end": 100, + "cn_1_guidance_end": 1, "cn_2_weight": 1, "cn_2_guidance_start": 0, - "cn_2_guidance_end": 100, + "cn_2_guidance_end": 1, "cn_3_weight": 1, "cn_3_guidance_start": 0, - "cn_3_guidance_end": 100, + "cn_3_guidance_end": 1, "cn_4_weight": 1, "cn_4_guidance_start": 0, - "cn_4_guidance_end": 100, + "cn_4_guidance_end": 1, "cn_5_weight": 1, "cn_5_guidance_start": 0, - "cn_5_guidance_end": 100, + "cn_5_guidance_end": 1, "guided_blendFactorMax": 0.35, "guided_blendFactorSlope": 0.25, "guided_tweening_frames": 20, @@ -301,31 +301,31 @@ exports[`Blank document 1`] = ` "cn_1_weight_pc": 100, "cn_1_guidance_start_delta": 0, "cn_1_guidance_start_pc": 0, - "cn_1_guidance_end_delta": 100, + "cn_1_guidance_end_delta": 1, "cn_1_guidance_end_pc": 100, "cn_2_weight_delta": 1, "cn_2_weight_pc": 100, "cn_2_guidance_start_delta": 0, "cn_2_guidance_start_pc": 0, - "cn_2_guidance_end_delta": 100, + "cn_2_guidance_end_delta": 1, "cn_2_guidance_end_pc": 100, "cn_3_weight_delta": 1, "cn_3_weight_pc": 100, "cn_3_guidance_start_delta": 0, "cn_3_guidance_start_pc": 0, - "cn_3_guidance_end_delta": 100, + "cn_3_guidance_end_delta": 1, "cn_3_guidance_end_pc": 100, "cn_4_weight_delta": 1, "cn_4_weight_pc": 100, "cn_4_guidance_start_delta": 0, "cn_4_guidance_start_pc": 0, - "cn_4_guidance_end_delta": 100, + "cn_4_guidance_end_delta": 1, "cn_4_guidance_end_pc": 100, "cn_5_weight_delta": 1, "cn_5_weight_pc": 100, "cn_5_guidance_start_delta": 0, "cn_5_guidance_start_pc": 0, - "cn_5_guidance_end_delta": 100, + "cn_5_guidance_end_delta": 1, "cn_5_guidance_end_pc": 100, "guided_blendFactorMax_delta": 0.35, "guided_blendFactorMax_pc": 100, @@ -384,19 +384,19 @@ exports[`Blank document 1`] = ` "redo_flow_factor": 1, "cn_1_weight": 1, "cn_1_guidance_start": 0, - "cn_1_guidance_end": 100, + "cn_1_guidance_end": 1, "cn_2_weight": 1, "cn_2_guidance_start": 0, - "cn_2_guidance_end": 100, + "cn_2_guidance_end": 1, "cn_3_weight": 1, "cn_3_guidance_start": 0, - "cn_3_guidance_end": 100, + "cn_3_guidance_end": 1, "cn_4_weight": 1, "cn_4_guidance_start": 0, - "cn_4_guidance_end": 100, + "cn_4_guidance_end": 1, "cn_5_weight": 1, "cn_5_guidance_start": 0, - "cn_5_guidance_end": 100, + "cn_5_guidance_end": 1, "guided_blendFactorMax": 0.35, "guided_blendFactorSlope": 0.25, "guided_tweening_frames": 20, @@ -579,19 +579,19 @@ exports[`Blank document 1`] = ` "redo_flow_factor": 1, "cn_1_weight": 1, "cn_1_guidance_start": 0, - "cn_1_guidance_end": 100, + "cn_1_guidance_end": 1, "cn_2_weight": 1, "cn_2_guidance_start": 0, - "cn_2_guidance_end": 100, + "cn_2_guidance_end": 1, "cn_3_weight": 1, "cn_3_guidance_start": 0, - "cn_3_guidance_end": 100, + "cn_3_guidance_end": 1, "cn_4_weight": 1, "cn_4_guidance_start": 0, - "cn_4_guidance_end": 100, + "cn_4_guidance_end": 1, "cn_5_weight": 1, "cn_5_guidance_start": 0, - "cn_5_guidance_end": 100, + "cn_5_guidance_end": 1, "guided_blendFactorMax": 0.35, "guided_blendFactorSlope": 0.25, "guided_tweening_frames": 20, @@ -774,19 +774,19 @@ exports[`Blank document 1`] = ` "redo_flow_factor": 1, "cn_1_weight": 1, "cn_1_guidance_start": 0, - "cn_1_guidance_end": 100, + "cn_1_guidance_end": 1, "cn_2_weight": 1, "cn_2_guidance_start": 0, - "cn_2_guidance_end": 100, + "cn_2_guidance_end": 1, "cn_3_weight": 1, "cn_3_guidance_start": 0, - "cn_3_guidance_end": 100, + "cn_3_guidance_end": 1, "cn_4_weight": 1, "cn_4_guidance_start": 0, - "cn_4_guidance_end": 100, + "cn_4_guidance_end": 1, "cn_5_weight": 1, "cn_5_guidance_start": 0, - "cn_5_guidance_end": 100, + "cn_5_guidance_end": 1, "guided_blendFactorMax": 0.35, "guided_blendFactorSlope": 0.25, "guided_tweening_frames": 20, @@ -969,19 +969,19 @@ exports[`Blank document 1`] = ` "redo_flow_factor": 1, "cn_1_weight": 1, "cn_1_guidance_start": 0, - "cn_1_guidance_end": 100, + "cn_1_guidance_end": 1, "cn_2_weight": 1, "cn_2_guidance_start": 0, - "cn_2_guidance_end": 100, + "cn_2_guidance_end": 1, "cn_3_weight": 1, "cn_3_guidance_start": 0, - "cn_3_guidance_end": 100, + "cn_3_guidance_end": 1, "cn_4_weight": 1, "cn_4_guidance_start": 0, - "cn_4_guidance_end": 100, + "cn_4_guidance_end": 1, "cn_5_weight": 1, "cn_5_guidance_start": 0, - "cn_5_guidance_end": 100, + "cn_5_guidance_end": 1, "guided_blendFactorMax": 0.35, "guided_blendFactorSlope": 0.25, "guided_tweening_frames": 20, @@ -1164,19 +1164,19 @@ exports[`Blank document 1`] = ` "redo_flow_factor": 1, "cn_1_weight": 1, "cn_1_guidance_start": 0, - "cn_1_guidance_end": 100, + "cn_1_guidance_end": 1, "cn_2_weight": 1, "cn_2_guidance_start": 0, - "cn_2_guidance_end": 100, + "cn_2_guidance_end": 1, "cn_3_weight": 1, "cn_3_guidance_start": 0, - "cn_3_guidance_end": 100, + "cn_3_guidance_end": 1, "cn_4_weight": 1, "cn_4_guidance_start": 0, - "cn_4_guidance_end": 100, + "cn_4_guidance_end": 1, "cn_5_weight": 1, "cn_5_guidance_start": 0, - "cn_5_guidance_end": 100, + "cn_5_guidance_end": 1, "guided_blendFactorMax": 0.35, "guided_blendFactorSlope": 0.25, "guided_tweening_frames": 20, @@ -1359,19 +1359,19 @@ exports[`Blank document 1`] = ` "redo_flow_factor": 1, "cn_1_weight": 1, "cn_1_guidance_start": 0, - "cn_1_guidance_end": 100, + "cn_1_guidance_end": 1, "cn_2_weight": 1, "cn_2_guidance_start": 0, - "cn_2_guidance_end": 100, + "cn_2_guidance_end": 1, "cn_3_weight": 1, "cn_3_guidance_start": 0, - "cn_3_guidance_end": 100, + "cn_3_guidance_end": 1, "cn_4_weight": 1, "cn_4_guidance_start": 0, - "cn_4_guidance_end": 100, + "cn_4_guidance_end": 1, "cn_5_weight": 1, "cn_5_guidance_start": 0, - "cn_5_guidance_end": 100, + "cn_5_guidance_end": 1, "guided_blendFactorMax": 0.35, "guided_blendFactorSlope": 0.25, "guided_tweening_frames": 20, @@ -1554,19 +1554,19 @@ exports[`Blank document 1`] = ` "redo_flow_factor": 1, "cn_1_weight": 1, "cn_1_guidance_start": 0, - "cn_1_guidance_end": 100, + "cn_1_guidance_end": 1, "cn_2_weight": 1, "cn_2_guidance_start": 0, - "cn_2_guidance_end": 100, + "cn_2_guidance_end": 1, "cn_3_weight": 1, "cn_3_guidance_start": 0, - "cn_3_guidance_end": 100, + "cn_3_guidance_end": 1, "cn_4_weight": 1, "cn_4_guidance_start": 0, - "cn_4_guidance_end": 100, + "cn_4_guidance_end": 1, "cn_5_weight": 1, "cn_5_guidance_start": 0, - "cn_5_guidance_end": 100, + "cn_5_guidance_end": 1, "guided_blendFactorMax": 0.35, "guided_blendFactorSlope": 0.25, "guided_tweening_frames": 20, @@ -1749,19 +1749,19 @@ exports[`Blank document 1`] = ` "redo_flow_factor": 1, "cn_1_weight": 1, "cn_1_guidance_start": 0, - "cn_1_guidance_end": 100, + "cn_1_guidance_end": 1, "cn_2_weight": 1, "cn_2_guidance_start": 0, - "cn_2_guidance_end": 100, + "cn_2_guidance_end": 1, "cn_3_weight": 1, "cn_3_guidance_start": 0, - "cn_3_guidance_end": 100, + "cn_3_guidance_end": 1, "cn_4_weight": 1, "cn_4_guidance_start": 0, - "cn_4_guidance_end": 100, + "cn_4_guidance_end": 1, "cn_5_weight": 1, "cn_5_guidance_start": 0, - "cn_5_guidance_end": 100, + "cn_5_guidance_end": 1, "guided_blendFactorMax": 0.35, "guided_blendFactorSlope": 0.25, "guided_tweening_frames": 20, @@ -1944,19 +1944,19 @@ exports[`Blank document 1`] = ` "redo_flow_factor": 1, "cn_1_weight": 1, "cn_1_guidance_start": 0, - "cn_1_guidance_end": 100, + "cn_1_guidance_end": 1, "cn_2_weight": 1, "cn_2_guidance_start": 0, - "cn_2_guidance_end": 100, + "cn_2_guidance_end": 1, "cn_3_weight": 1, "cn_3_guidance_start": 0, - "cn_3_guidance_end": 100, + "cn_3_guidance_end": 1, "cn_4_weight": 1, "cn_4_guidance_start": 0, - "cn_4_guidance_end": 100, + "cn_4_guidance_end": 1, "cn_5_weight": 1, "cn_5_guidance_start": 0, - "cn_5_guidance_end": 100, + "cn_5_guidance_end": 1, "guided_blendFactorMax": 0.35, "guided_blendFactorSlope": 0.25, "guided_tweening_frames": 20, @@ -2139,19 +2139,19 @@ exports[`Blank document 1`] = ` "redo_flow_factor": 1, "cn_1_weight": 1, "cn_1_guidance_start": 0, - "cn_1_guidance_end": 100, + "cn_1_guidance_end": 1, "cn_2_weight": 1, "cn_2_guidance_start": 0, - "cn_2_guidance_end": 100, + "cn_2_guidance_end": 1, "cn_3_weight": 1, "cn_3_guidance_start": 0, - "cn_3_guidance_end": 100, + "cn_3_guidance_end": 1, "cn_4_weight": 1, "cn_4_guidance_start": 0, - "cn_4_guidance_end": 100, + "cn_4_guidance_end": 1, "cn_5_weight": 1, "cn_5_guidance_start": 0, - "cn_5_guidance_end": 100, + "cn_5_guidance_end": 1, "guided_blendFactorMax": 0.35, "guided_blendFactorSlope": 0.25, "guided_tweening_frames": 20, @@ -2519,8 +2519,8 @@ exports[`Blank document 1`] = ` "isFlat": true }, "cn_1_guidance_end": { - "max": 100, - "min": 100, + "max": 1, + "min": 1, "isFlat": true }, "cn_2_weight": { @@ -2534,8 +2534,8 @@ exports[`Blank document 1`] = ` "isFlat": true }, "cn_2_guidance_end": { - "max": 100, - "min": 100, + "max": 1, + "min": 1, "isFlat": true }, "cn_3_weight": { @@ -2549,8 +2549,8 @@ exports[`Blank document 1`] = ` "isFlat": true }, "cn_3_guidance_end": { - "max": 100, - "min": 100, + "max": 1, + "min": 1, "isFlat": true }, "cn_4_weight": { @@ -2564,8 +2564,8 @@ exports[`Blank document 1`] = ` "isFlat": true }, "cn_4_guidance_end": { - "max": 100, - "min": 100, + "max": 1, + "min": 1, "isFlat": true }, "cn_5_weight": { @@ -2579,8 +2579,8 @@ exports[`Blank document 1`] = ` "isFlat": true }, "cn_5_guidance_end": { - "max": 100, - "min": 100, + "max": 1, + "min": 1, "isFlat": true }, "guided_blendFactorMax": { @@ -3115,6 +3115,329 @@ exports[`Cadence 1`] = ` `; +exports[`Common prompt template 1`] = ` +
+  {
+    "meta": {
+        "generated_by": "sd_parseq",
+        "version": "Sun, 01 Jan 2023 14:00:00 GMT",
+        "generated_at": "0.0.test",
+        "doc_id": "unknown",
+        "version_id": "unknown"
+    },
+    "prompts": {
+        "format": "v2",
+        "enabled": true,
+        "commonPrompt": {
+            "name": "Common",
+            "positive": "a [prompt] b c",
+            "negative": "",
+            "allFrames": true,
+            "from": 0,
+            "to": 119,
+            "overlap": {
+                "inFrames": 0,
+                "outFrames": 0,
+                "type": "none",
+                "custom": "prompt_weight_1"
+            }
+        },
+        "commonPromptPos": "template",
+        "promptList": [
+            {
+                "name": "Prompt 1",
+                "positive": "A lone (black cat:\${prompt_weight_1})",
+                "negative": "(black cat:\${prompt_weight_2})",
+                "allFrames": false,
+                "from": 0,
+                "to": 15,
+                "overlap": {
+                    "inFrames": 0,
+                    "outFrames": 5,
+                    "type": "linear",
+                    "custom": "prompt_weight_1"
+                }
+            },
+            {
+                "positive": "A lone (black duck:\${prompt_weight_1})",
+                "negative": "nothing",
+                "from": 10,
+                "to": 20,
+                "allFrames": false,
+                "name": "Prompt 2",
+                "overlap": {
+                    "inFrames": 5,
+                    "outFrames": 0,
+                    "type": "linear",
+                    "custom": "prompt_weight_2"
+                }
+            }
+        ]
+    },
+    "options": {
+        "input_fps": 20,
+        "bpm": 140,
+        "output_fps": 20,
+        "cc_window_width": 0,
+        "cc_window_slide_rate": 1,
+        "cc_use_input": false,
+        "cadence": 1
+    },
+    "managedFields": [
+        "prompt_weight_1",
+        "prompt_weight_2"
+    ],
+    "displayedFields": [
+        "prompt_weight_1",
+        "prompt_weight_2"
+    ],
+    "keyframes": [
+        {
+            "frame": 0,
+            "prompt_weight_1": 1,
+            "prompt_weight_1_i": "bez(0,0.6,1,0.4)",
+            "prompt_weight_2": 0,
+            "prompt_weight_2_i": "bez(0,0.6,1,0.4)"
+        },
+        {
+            "frame": 20,
+            "prompt_weight_1": 0,
+            "prompt_weight_2": 1
+        }
+    ],
+    "timeSeries": [],
+    "keyframeLock": "frames",
+    "reverseRender": false,
+    "rendered_frames": [
+        {
+            "frame": 0,
+            "prompt_weight_1": 1,
+            "prompt_weight_2": 0,
+            "deforum_prompt": "a A lone (black cat:1.00000) b c --neg (black cat:0.00000)",
+            "prompt_weight_1_delta": 1,
+            "prompt_weight_1_pc": 100,
+            "prompt_weight_2_delta": 0,
+            "prompt_weight_2_pc": 0
+        },
+        {
+            "frame": 1,
+            "prompt_weight_1": 0.7963693480911492,
+            "prompt_weight_2": 0.2036306519088508,
+            "deforum_prompt": "a A lone (black cat:0.79637) b c --neg (black cat:0.20363)",
+            "prompt_weight_1_delta": -0.20363065190885077,
+            "prompt_weight_1_pc": 79.63693480911492,
+            "prompt_weight_2_delta": 0.2036306519088508,
+            "prompt_weight_2_pc": 20.36306519088508
+        },
+        {
+            "frame": 2,
+            "prompt_weight_1": 0.7275598098136349,
+            "prompt_weight_2": 0.27244019018636506,
+            "deforum_prompt": "a A lone (black cat:0.72756) b c --neg (black cat:0.27244)",
+            "prompt_weight_1_delta": -0.06880953827751435,
+            "prompt_weight_1_pc": 72.75598098136349,
+            "prompt_weight_2_delta": 0.06880953827751426,
+            "prompt_weight_2_pc": 27.244019018636507
+        },
+        {
+            "frame": 3,
+            "prompt_weight_1": 0.68007576198834,
+            "prompt_weight_2": 0.3199242380116601,
+            "deforum_prompt": "a A lone (black cat:0.68008) b c --neg (black cat:0.31992)",
+            "prompt_weight_1_delta": -0.04748404782529492,
+            "prompt_weight_1_pc": 68.007576198834,
+            "prompt_weight_2_delta": 0.04748404782529503,
+            "prompt_weight_2_pc": 31.99242380116601
+        },
+        {
+            "frame": 4,
+            "prompt_weight_1": 0.6431466942498671,
+            "prompt_weight_2": 0.35685330575013285,
+            "deforum_prompt": "a A lone (black cat:0.64315) b c --neg (black cat:0.35685)",
+            "prompt_weight_1_delta": -0.03692906773847282,
+            "prompt_weight_1_pc": 64.31466942498672,
+            "prompt_weight_2_delta": 0.036929067738472765,
+            "prompt_weight_2_pc": 35.68533057501328
+        },
+        {
+            "frame": 5,
+            "prompt_weight_1": 0.6125667198004746,
+            "prompt_weight_2": 0.3874332801995254,
+            "deforum_prompt": "a A lone (black cat:0.61257) b c --neg (black cat:0.38743)",
+            "prompt_weight_1_delta": -0.030579974449392533,
+            "prompt_weight_1_pc": 61.256671980047464,
+            "prompt_weight_2_delta": 0.030579974449392533,
+            "prompt_weight_2_pc": 38.743328019952536
+        },
+        {
+            "frame": 6,
+            "prompt_weight_1": 0.5861365160369783,
+            "prompt_weight_2": 0.41386348396302175,
+            "deforum_prompt": "a A lone (black cat:0.58614) b c --neg (black cat:0.41386)",
+            "prompt_weight_1_delta": -0.026430203763496363,
+            "prompt_weight_1_pc": 58.613651603697825,
+            "prompt_weight_2_delta": 0.026430203763496363,
+            "prompt_weight_2_pc": 41.386348396302175
+        },
+        {
+            "frame": 7,
+            "prompt_weight_1": 0.5625014551536172,
+            "prompt_weight_2": 0.4374985448463828,
+            "deforum_prompt": "a A lone (black cat:0.56250) b c --neg (black cat:0.43750)",
+            "prompt_weight_1_delta": -0.023635060883361092,
+            "prompt_weight_1_pc": 56.250145515361716,
+            "prompt_weight_2_delta": 0.023635060883361036,
+            "prompt_weight_2_pc": 43.74985448463828
+        },
+        {
+            "frame": 8,
+            "prompt_weight_1": 0.5407240611340829,
+            "prompt_weight_2": 0.45927593886591717,
+            "deforum_prompt": "a A lone (black cat:0.54072) b c --neg (black cat:0.45928)",
+            "prompt_weight_1_delta": -0.02177739401953427,
+            "prompt_weight_1_pc": 54.07240611340829,
+            "prompt_weight_2_delta": 0.02177739401953438,
+            "prompt_weight_2_pc": 45.927593886591715
+        },
+        {
+            "frame": 9,
+            "prompt_weight_1": 0.520089286307738,
+            "prompt_weight_2": 0.479910713692262,
+            "deforum_prompt": "a A lone (black cat:0.52009) b c --neg (black cat:0.47991)",
+            "prompt_weight_1_delta": -0.020634774826344904,
+            "prompt_weight_1_pc": 52.008928630773795,
+            "prompt_weight_2_delta": 0.02063477482634485,
+            "prompt_weight_2_pc": 47.991071369226205
+        },
+        {
+            "frame": 10,
+            "prompt_weight_1": 0.5,
+            "prompt_weight_2": 0.5,
+            "deforum_prompt": "a A lone (black cat:0.50000) b c: 1 AND a A lone (black duck:0.50000) b c: 0.000 --neg (black cat:0.50000): 1 AND nothing: 0.000",
+            "prompt_weight_1_delta": -0.020089286307737986,
+            "prompt_weight_1_pc": 50,
+            "prompt_weight_2_delta": 0.020089286307737986,
+            "prompt_weight_2_pc": 50
+        },
+        {
+            "frame": 11,
+            "prompt_weight_1": 0.4799107136922619,
+            "prompt_weight_2": 0.5200892863077381,
+            "deforum_prompt": "a A lone (black cat:0.47991) b c: 0.8000 AND a A lone (black duck:0.47991) b c: 0.2000 --neg (black cat:0.52009): 0.8000 AND nothing: 0.2000",
+            "prompt_weight_1_delta": -0.020089286307738097,
+            "prompt_weight_1_pc": 47.99107136922619,
+            "prompt_weight_2_delta": 0.020089286307738097,
+            "prompt_weight_2_pc": 52.00892863077381
+        },
+        {
+            "frame": 12,
+            "prompt_weight_1": 0.4592759388659172,
+            "prompt_weight_2": 0.5407240611340828,
+            "deforum_prompt": "a A lone (black cat:0.45928) b c: 0.6000 AND a A lone (black duck:0.45928) b c: 0.4000 --neg (black cat:0.54072): 0.6000 AND nothing: 0.4000",
+            "prompt_weight_1_delta": -0.020634774826344682,
+            "prompt_weight_1_pc": 45.92759388659172,
+            "prompt_weight_2_delta": 0.020634774826344682,
+            "prompt_weight_2_pc": 54.07240611340828
+        },
+        {
+            "frame": 13,
+            "prompt_weight_1": 0.43749854484638284,
+            "prompt_weight_2": 0.5625014551536172,
+            "deforum_prompt": "a A lone (black cat:0.43750) b c: 0.4000 AND a A lone (black duck:0.43750) b c: 0.6000 --neg (black cat:0.56250): 0.4000 AND nothing: 0.6000",
+            "prompt_weight_1_delta": -0.02177739401953438,
+            "prompt_weight_1_pc": 43.749854484638284,
+            "prompt_weight_2_delta": 0.02177739401953438,
+            "prompt_weight_2_pc": 56.250145515361716
+        },
+        {
+            "frame": 14,
+            "prompt_weight_1": 0.41386348396302175,
+            "prompt_weight_2": 0.5861365160369783,
+            "deforum_prompt": "a A lone (black cat:0.41386) b c: 0.2000 AND a A lone (black duck:0.41386) b c: 0.8000 --neg (black cat:0.58614): 0.2000 AND nothing: 0.8000",
+            "prompt_weight_1_delta": -0.023635060883361092,
+            "prompt_weight_1_pc": 41.386348396302175,
+            "prompt_weight_2_delta": 0.023635060883361092,
+            "prompt_weight_2_pc": 58.613651603697825
+        },
+        {
+            "frame": 15,
+            "prompt_weight_1": 0.3874332801995253,
+            "prompt_weight_2": 0.6125667198004747,
+            "deforum_prompt": "a A lone (black cat:0.38743) b c: 0.000 AND a A lone (black duck:0.38743) b c: 1 --neg (black cat:0.61257): 0.000 AND nothing: 1",
+            "prompt_weight_1_delta": -0.026430203763496474,
+            "prompt_weight_1_pc": 38.74332801995253,
+            "prompt_weight_2_delta": 0.026430203763496474,
+            "prompt_weight_2_pc": 61.25667198004747
+        },
+        {
+            "frame": 16,
+            "prompt_weight_1": 0.35685330575013285,
+            "prompt_weight_2": 0.6431466942498671,
+            "deforum_prompt": "a A lone (black duck:0.35685) b c --neg nothing",
+            "prompt_weight_1_delta": -0.030579974449392422,
+            "prompt_weight_1_pc": 35.68533057501328,
+            "prompt_weight_2_delta": 0.030579974449392422,
+            "prompt_weight_2_pc": 64.31466942498672
+        },
+        {
+            "frame": 17,
+            "prompt_weight_1": 0.31992423801166014,
+            "prompt_weight_2": 0.6800757619883399,
+            "deforum_prompt": "a A lone (black duck:0.31992) b c --neg nothing",
+            "prompt_weight_1_delta": -0.03692906773847271,
+            "prompt_weight_1_pc": 31.992423801166016,
+            "prompt_weight_2_delta": 0.03692906773847271,
+            "prompt_weight_2_pc": 68.00757619883399
+        },
+        {
+            "frame": 18,
+            "prompt_weight_1": 0.272440190186365,
+            "prompt_weight_2": 0.727559809813635,
+            "deforum_prompt": "a A lone (black duck:0.27244) b c --neg nothing",
+            "prompt_weight_1_delta": -0.04748404782529514,
+            "prompt_weight_1_pc": 27.2440190186365,
+            "prompt_weight_2_delta": 0.04748404782529514,
+            "prompt_weight_2_pc": 72.75598098136349
+        },
+        {
+            "frame": 19,
+            "prompt_weight_1": 0.203630651908851,
+            "prompt_weight_2": 0.796369348091149,
+            "deforum_prompt": "a A lone (black duck:0.20363) b c --neg nothing",
+            "prompt_weight_1_delta": -0.06880953827751402,
+            "prompt_weight_1_pc": 20.3630651908851,
+            "prompt_weight_2_delta": 0.06880953827751402,
+            "prompt_weight_2_pc": 79.6369348091149
+        },
+        {
+            "frame": 20,
+            "prompt_weight_1": 0,
+            "prompt_weight_2": 1,
+            "deforum_prompt": "a A lone (black duck:0.00000) b c --neg nothing",
+            "prompt_weight_1_delta": -0.203630651908851,
+            "prompt_weight_1_pc": 0,
+            "prompt_weight_2_delta": 0.203630651908851,
+            "prompt_weight_2_pc": 100
+        }
+    ],
+    "rendered_frames_meta": {
+        "prompt_weight_1": {
+            "max": 1,
+            "min": 0,
+            "isFlat": false
+        },
+        "prompt_weight_2": {
+            "max": 1,
+            "min": 0,
+            "isFlat": false
+        }
+    }
+}
+
+`; + exports[`Delegated seed 1`] = `
(_.cloneDeep(props.initialPrompts));
     const [quickPreviewPosition, setQuickPreviewPosition] = useState(0);
     const [quickPreview, setQuickPreview] = useState("");
+    const [promptWarning, setPromptWarning] = useState();
     const theme = extendTheme(themeFactory());
 
 
@@ -157,8 +158,9 @@ export function Prompts(props: PromptsProps) {
     const promptInput = useCallback((index: number, positive: boolean) => {
 
         const posNegStr = positive ? 'positive' : 'negative';
-        const unsavedPrompt = index >= 0 ? unsavedPrompts.promptList[index] : unsavedPrompts.commonPrompt;
-        const initPrompt = index >= 0 ? props.initialPrompts.promptList[index] : props.initialPrompts.commonPrompt;
+        const isCommonPrompt = index < 0;
+        const unsavedPrompt = isCommonPrompt ? unsavedPrompts.commonPrompt : unsavedPrompts.promptList[index];
+        const initPrompt = isCommonPrompt ?  props.initialPrompts.commonPrompt : props.initialPrompts.promptList[index];
 
         const hasUnsavedChanges = initPrompt && (unsavedPrompt[posNegStr] !== initPrompt[posNegStr]);
 
@@ -170,12 +172,13 @@ export function Prompts(props: PromptsProps) {
             style={{ paddingRight: '20px' }}
             label={(positive ? "Positive" : "Negative") + " " + unsavedPrompt?.name?.toLowerCase()}
             value={unsavedPrompt[posNegStr]}
+            placeholder={(isCommonPrompt && unsavedPrompts.commonPromptPos === 'template') ? "your prefix [prompt] your suffix" : ""}
             InputProps={{
                 style: { fontSize: '0.7em', fontFamily: 'Monospace', color: positive ? theme.vars.palette.positive.main : theme.vars.palette.negative.main },
                 sx: { background: hasUnsavedChanges ? theme.vars.palette.unsavedbg.main : '', },
                 endAdornment: hasUnsavedChanges ? '🖊️' : ''
             }}
-            onBlur={(e: any) => {
+            onBlur={(e: any) => {          
                 commitChanges(unsavedPrompts);
             }}
             onKeyDown={(e: any) => {
@@ -192,8 +195,16 @@ export function Prompts(props: PromptsProps) {
                 }
             }}
             onChange={(e: any) => {
+                if (isCommonPrompt
+                    && unsavedPrompts.commonPromptPos === 'template'
+                    && e.target.value.trim() !== ''
+                    && !e.target.value.includes('[prompt]')) {
+                        setPromptWarning("In template mode, common prompts must either be empty or contain '[prompt]'.");
+                } else {
+                    setPromptWarning(undefined);                  
+                }                     
                 unsavedPrompt[posNegStr] = e.target.value;
-                setUnsavedPrompts({ ...unsavedPrompts });
+                setUnsavedPrompts({ ...unsavedPrompts });  
             }}
             InputLabelProps={{ shrink: true, style: { fontSize: '0.9em' } }}
             size="small"
@@ -549,12 +560,13 @@ export function Prompts(props: PromptsProps) {
                                 InputProps={{ style: { fontSize: '0.75em' } }}
                                 value={advancedPrompts.commonPromptPos}
                                 onChange={(e: any) => {
-                                    advancedPrompts.commonPromptPos = (e.target.value as "append"|"prepend");
+                                    advancedPrompts.commonPromptPos = (e.target.value as "append"|"prepend"|"template");
                                     commitChanges({ ...unsavedPrompts });
                                 }}
                             >
                                     Append to all prompts
                                     Prepend to all prompts
+                                    Template mode: insert all prompts at [prompt]
                                 
                             
                         
@@ -566,10 +578,11 @@ export function Prompts(props: PromptsProps) {
                             {promptInput(-1, false)}
                         
                     
+                    { promptWarning ? {promptWarning} : <> }
                 
             }
         
-        , [delPrompt, promptInput, unsavedPrompts, props, displayFadeOptions, composableDiffusionWarning, commitChanges, theme]);
+        , [delPrompt, promptInput, unsavedPrompts, props, displayFadeOptions, composableDiffusionWarning, commitChanges, promptWarning, theme]);
 
 
     const reorderPrompts = useCallback(() => {
diff --git a/src/parseq-renderer.ts b/src/parseq-renderer.ts
index d17f092..679bf20 100644
--- a/src/parseq-renderer.ts
+++ b/src/parseq-renderer.ts
@@ -352,13 +352,16 @@ function evaluateParseqExpressions(str: string, ctx: InvocationContext): string
 
 function getPromptsWithWeights(prompts: AdvancedParseqPromptsV2, frame: number, lastFrame: number): UnevaluatedPromptsAndWeights {
 
-    const promptPrefix = {
-        positive: (prompts.commonPromptPos === 'prepend' && prompts.commonPrompt.positive ? `${prompts.commonPrompt.positive} ` : ''),
-        negative: (prompts.commonPromptPos === 'prepend' && prompts.commonPrompt.negative ? `${prompts.commonPrompt.negative} ` : '')
-    }
-    const promptSuffix = {
-        positive: (prompts.commonPromptPos === 'append' && prompts.commonPrompt.positive ? ` ${prompts.commonPrompt.positive}` : ''),
-        negative: (prompts.commonPromptPos === 'append' && prompts.commonPrompt.negative ? ` ${prompts.commonPrompt.negative}` : '')
+    const applyCommonPrompt = (prompt:string, positive:boolean) => {
+        const commonPrompt = prompts.commonPrompt[positive ? 'positive' : 'negative'];
+        switch (prompts.commonPromptPos) {
+            case 'append':
+                return `${prompt} ${commonPrompt}`.trim()
+            case 'prepend':
+                return `${commonPrompt} ${prompt}`.trim()
+            case 'template':
+                return commonPrompt.trim() === '' ? prompt : commonPrompt.replace(/\[prompt\]/g, prompt);
+        }
     }
 
     return prompts.promptList
@@ -368,8 +371,8 @@ function getPromptsWithWeights(prompts: AdvancedParseqPromptsV2, frame: number,
         }))
         .filter(p => p.allFrames || (frame >= p.from && frame <= p.to))
         .map(p => ({
-            positive: promptPrefix.positive + p.positive + promptSuffix.positive,
-            negative: promptPrefix.negative + p.negative + promptSuffix.negative,
+            positive: applyCommonPrompt(p.positive, true),
+            negative: applyCommonPrompt(p.negative, false),
             weight: calculateWeight(p, frame, lastFrame)
         }));
 }
\ No newline at end of file