Skip to content

Commit

Permalink
Add support for templated common prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
rewbs committed Oct 27, 2023
1 parent a57fcc7 commit db00cbf
Show file tree
Hide file tree
Showing 5 changed files with 5,065 additions and 4,641 deletions.
85 changes: 85 additions & 0 deletions src/Deforum.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
2 changes: 1 addition & 1 deletion src/ParseqUI.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ type AdvancedParseqPromptsV2 = {
enabled: boolean;
promptList: AdvancedParseqPrompt[] | [];
commonPrompt: AdvancedParseqPrompt;
commonPromptPos: "append" | "prepend"
commonPromptPos: "append" | "prepend"| "template"
}

type ParseqPrompts = SimpleParseqPrompts | AdvancedParseqPrompts | AdvancedParseqPromptsV2;
Expand Down
Loading

0 comments on commit db00cbf

Please sign in to comment.