@gentbajko/slopify 3.0.10 → 3.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extension/slopify-studio-chrome.zip +0 -0
- package/dist/extension/slopify-studio-firefox.zip +0 -0
- package/dist/patch-notes/3.0.11.md +22 -0
- package/dist/patch-notes/3.0.12.md +25 -0
- package/dist/patch-notes/index.json +12 -0
- package/dist/slices/admission/substitute.js +7 -2
- package/dist/slices/images/appearance.js +107 -0
- package/dist/slices/images/scenes.js +50 -1
- package/dist/slices/rebuild/recipe-appearance.js +82 -0
- package/dist/slices/rebuild/recipe-build.js +9 -5
- package/dist/slices/rebuild/recipe-model.js +2 -0
- package/dist/slices/rebuild/recipe-provider-choice.js +2 -1
- package/dist/slices/rebuild/recipe-reference.js +22 -2
- package/dist/slices/rebuild/recipe-scenes.js +25 -4
- package/dist/slices/rebuild/recipe-validation.js +2 -2
- package/dist/slices/rebuild/recipe-visual.js +96 -38
- package/dist/slices/rebuild/recipe-work.js +4 -2
- package/dist/slices/rebuild/runtime-provider.js +16 -0
- package/dist/slices/revisions/publication-rules.js +11 -3
- package/dist/tutorials/Play-Images.md +10 -0
- package/dist/tutorials/Play-Outputs.md +1 -1
- package/dist/web/assets/index-BPstEgjc.js +309 -0
- package/dist/web/assets/index-BbbbM56z.css +1 -0
- package/dist/web/assets/{pdf-BlAr9_2d.js → pdf-DVDjUG4j.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +2 -2
- package/dist/web/assets/index-CVbfz76X.js +0 -310
- package/dist/web/assets/index-Cvuxycwt.css +0 -1
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Slopify 3.0.11
|
|
2
|
+
|
|
3
|
+
Released 29 September 2026.
|
|
4
|
+
|
|
5
|
+
3.0.11 keeps the calendar tidy on busy days and brings dependencies up to date.
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
- **A busy day no longer stretches the calendar.** Every day keeps the same height, however many projects it holds.
|
|
10
|
+
|
|
11
|
+
## Calendar
|
|
12
|
+
|
|
13
|
+
- The week grid uses the full width of the page.
|
|
14
|
+
- A day shows its first three projects, then "+N more"; press it to see the rest, and "Show fewer" to fold them again.
|
|
15
|
+
|
|
16
|
+
## Under the hood
|
|
17
|
+
|
|
18
|
+
- Updated React Router, Vite, YAML, Biome and Wrangler, and the Docker image's build actions.
|
|
19
|
+
|
|
20
|
+
## Upgrading from 3.0.10
|
|
21
|
+
|
|
22
|
+
- **Nothing becomes outdated.**
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Slopify 3.0.12
|
|
2
|
+
|
|
3
|
+
Released 30 September 2026.
|
|
4
|
+
|
|
5
|
+
3.0.12 lets image and thumbnail prompts look things up: how the subject and characters look, and which moment a thumbnail shows. It also fixes a finished video that could be refused after a long render.
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
- **`{{Appearance}}`: looks, looked up.** A figure is drawn the way people know it, and the same way in every picture.
|
|
10
|
+
- **Thumbnails take `{{Scene}}`.** Each thumbnail shows a striking moment from the article, a different one for each of three.
|
|
11
|
+
- **An edit during a render no longer fails the video.**
|
|
12
|
+
|
|
13
|
+
## Images and thumbnails
|
|
14
|
+
|
|
15
|
+
- Put `{{Appearance}}` in an image, thumbnail or establishing prompt, for example a line `Looks: {{Appearance}}`. Once the article is written, one call to the project's AI model searches the web for how the video's subject and every named character look, in their most iconic depiction. Each picture gets the looks of the figures its scene names; a thumbnail always gets the subject's. There is no switch: prompts without it are drawn as before. One more AI call per run.
|
|
16
|
+
- A thumbnail prompt with `{{Scene}}` gets a scene from Scenes from the article: the moment that would make someone click, taken from anywhere in the article, and a different one for each of three thumbnails. Before, `{{Scene}}` reached the image model as literal text.
|
|
17
|
+
|
|
18
|
+
## Fixes
|
|
19
|
+
|
|
20
|
+
- A video could render for hours and then stop with "Output fingerprint differs from its authorized recipe." when something in the project was changed while it rendered (a thumbnail made again, say). Its captions are now checked against the project as it is now. A video that failed this way renders again with **Try the video again**.
|
|
21
|
+
- Scroll bars are hidden everywhere; every area still scrolls.
|
|
22
|
+
|
|
23
|
+
## Upgrading from 3.0.11
|
|
24
|
+
|
|
25
|
+
- **Nothing becomes outdated.** Prompts without `{{Appearance}}` or a thumbnail `{{Scene}}` are drawn as before.
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"id": "3.0.12",
|
|
4
|
+
"title": "Slopify 3.0.12",
|
|
5
|
+
"version": "3.0.12",
|
|
6
|
+
"date": "2026-09-30"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id": "3.0.11",
|
|
10
|
+
"title": "Slopify 3.0.11",
|
|
11
|
+
"version": "3.0.11",
|
|
12
|
+
"date": "2026-09-29"
|
|
13
|
+
},
|
|
2
14
|
{
|
|
3
15
|
"id": "3.0.10",
|
|
4
16
|
"title": "Slopify 3.0.10",
|
|
@@ -40,15 +40,20 @@ export function detectSlots(body) {
|
|
|
40
40
|
// Filled by Slopify, never by the person: each image's own scene, which the project's AI model
|
|
41
41
|
// writes from the article when an image prompt asks for it (`images/scenes.ts`).
|
|
42
42
|
export const sceneKeyword = "Scene";
|
|
43
|
+
// Filled by Slopify too: how the video's subject and the characters in an image look, which the
|
|
44
|
+
// project's AI model looks up on the web when a prompt asks for it (`images/appearance.ts`).
|
|
45
|
+
export const appearanceKeyword = "Appearance";
|
|
46
|
+
// The keywords Slopify fills itself, which are never fields for the person.
|
|
47
|
+
export const filledKeywords = [sceneKeyword, appearanceKeyword];
|
|
43
48
|
// One field per distinct name; Common when a name is used on both sides, otherwise Text or
|
|
44
49
|
// Image. The order is first appearance, which is why both sides arrive as ordered lists of
|
|
45
|
-
// bodies rather than as sets. The scene
|
|
50
|
+
// bodies rather than as sets. The scene and appearance keywords are not fields: Slopify fills them.
|
|
46
51
|
export function collectFields(textBodies, imageBodies) {
|
|
47
52
|
const text = namesOf(textBodies);
|
|
48
53
|
const image = namesOf(imageBodies);
|
|
49
54
|
const fields = [];
|
|
50
55
|
for (const name of [...text, ...image]) {
|
|
51
|
-
if (name
|
|
56
|
+
if (filledKeywords.includes(name) || fields.some((field) => field.name === name)) {
|
|
52
57
|
continue;
|
|
53
58
|
}
|
|
54
59
|
const onText = text.includes(name);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { appearanceKeyword, detectSlots, render } from "../admission/substitute.js";
|
|
3
|
+
// How things look, looked up rather than guessed: when an image or thumbnail prompt has
|
|
4
|
+
// `{{Appearance}}`, one call to the project's AI model searches the web for how the video's
|
|
5
|
+
// subject and every named character in the article look in their best-known depiction. Each
|
|
6
|
+
// picture then gets the subject's look and the looks of the characters its scene names, so a
|
|
7
|
+
// figure looks the same from image to image and like the one people know.
|
|
8
|
+
export function usesAppearance(body) {
|
|
9
|
+
return body != null && detectSlots(body).names.includes(appearanceKeyword);
|
|
10
|
+
}
|
|
11
|
+
const figureSchema = z.object({
|
|
12
|
+
name: z.string(),
|
|
13
|
+
aliases: z.array(z.string()).default([]),
|
|
14
|
+
look: z.string(),
|
|
15
|
+
});
|
|
16
|
+
export const appearanceSchema = z.object({
|
|
17
|
+
subject: figureSchema,
|
|
18
|
+
characters: z.array(figureSchema).default([]),
|
|
19
|
+
});
|
|
20
|
+
export function appearanceMessages(brief) {
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
role: "system",
|
|
24
|
+
content: [
|
|
25
|
+
"You research how things look, for the pictures of a narrated video. Search the web before you answer: official art and its descriptions, the sourcebooks and the wikis that describe them. Do not describe a figure from memory alone.",
|
|
26
|
+
"Describe the video's subject: the figure, creature, place or object the video is about. Then describe every other named character who could appear in a picture: rivals, servants, gods, companions. Leave out people who only made or published the work, and anyone the article only mentions in passing.",
|
|
27
|
+
"When depictions disagree (different editions, different artists), describe the most iconic one: the look most people picture, usually the best-known official art.",
|
|
28
|
+
"Each look is two to four sentences of what can be seen: build and size, face, skin or hide, hair, clothing or armour, colours, and the objects or marks that make the figure recognisable. Nothing about art style or medium, and no story: the style and the scene are set elsewhere.",
|
|
29
|
+
'Answer with JSON and nothing else: {"subject": {"name": "…", "aliases": ["…"], "look": "…"}, "characters": [{"name": "…", "aliases": ["…"], "look": "…"}]}. Aliases are other names or titles the article uses for the same figure.',
|
|
30
|
+
].join("\n\n"),
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
role: "user",
|
|
34
|
+
content: [
|
|
35
|
+
`Video: ${brief.title}`,
|
|
36
|
+
brief.article.trim() === "" ? "" : `Article:\n\n${brief.article}`,
|
|
37
|
+
]
|
|
38
|
+
.filter((part) => part !== "")
|
|
39
|
+
.join("\n\n"),
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
export function checkAppearance(text) {
|
|
44
|
+
const fix = "Use Try again; if it keeps happening, choose another model in the Providers section of Edit project.";
|
|
45
|
+
const parsed = appearanceSchema.safeParse(jsonObjectOf(text));
|
|
46
|
+
if (!parsed.success)
|
|
47
|
+
return { ok: false, reason: `The AI model didn't answer with the looks it looked up. ${fix}` };
|
|
48
|
+
const tidy = (figure) => ({
|
|
49
|
+
name: figure.name.trim(),
|
|
50
|
+
aliases: figure.aliases.map((alias) => alias.trim()).filter((alias) => alias !== ""),
|
|
51
|
+
look: figure.look.replace(/\s+/g, " ").trim(),
|
|
52
|
+
});
|
|
53
|
+
const subject = tidy(parsed.data.subject);
|
|
54
|
+
if (subject.name === "" || subject.look === "")
|
|
55
|
+
return { ok: false, reason: `The AI model described no look for the video's subject. ${fix}` };
|
|
56
|
+
return {
|
|
57
|
+
ok: true,
|
|
58
|
+
appearance: {
|
|
59
|
+
subject,
|
|
60
|
+
characters: parsed.data.characters
|
|
61
|
+
.map(tidy)
|
|
62
|
+
.filter((figure) => figure.name !== "" && figure.look !== ""),
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
// The most characters besides the subject one picture describes: a crowded prompt is ignored.
|
|
67
|
+
const charactersPerPicture = 3;
|
|
68
|
+
// What `{{Appearance}}` becomes in one picture: the looks of the figures the picture's scene
|
|
69
|
+
// names (by name or alias, as a whole word), the subject first. Without a scene, the subject
|
|
70
|
+
// alone. The subject goes in only when the scene names it, unless it always does (a thumbnail
|
|
71
|
+
// stands for the subject): a scene of a place, or of another figure, is not redrawn with the
|
|
72
|
+
// subject in it. Empty when the scene names no one.
|
|
73
|
+
export function appearanceFor(appearance, scene, options = {}) {
|
|
74
|
+
const shown = (figure) => scene !== undefined && [figure.name, ...figure.aliases].some((name) => names(scene, name));
|
|
75
|
+
const subject = scene === undefined || options.subjectAlways === true || shown(appearance.subject)
|
|
76
|
+
? [appearance.subject]
|
|
77
|
+
: [];
|
|
78
|
+
const named = appearance.characters.filter(shown).slice(0, charactersPerPicture);
|
|
79
|
+
return [...subject, ...named].map((figure) => `${figure.name}: ${figure.look}`).join("\n");
|
|
80
|
+
}
|
|
81
|
+
// The prompt with its looks; a line asking for looks nobody in the picture has is left out.
|
|
82
|
+
export function withAppearance(body, text) {
|
|
83
|
+
if (text !== "")
|
|
84
|
+
return render(body, { [appearanceKeyword]: text });
|
|
85
|
+
return body
|
|
86
|
+
.split("\n")
|
|
87
|
+
.filter((line) => !usesAppearance(line))
|
|
88
|
+
.join("\n")
|
|
89
|
+
.replace(/\n{3,}/g, "\n\n")
|
|
90
|
+
.trim();
|
|
91
|
+
}
|
|
92
|
+
function names(text, name) {
|
|
93
|
+
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
94
|
+
return new RegExp(`(^|[^\\p{L}\\p{N}])${escaped}($|[^\\p{L}\\p{N}])`, "iu").test(text);
|
|
95
|
+
}
|
|
96
|
+
function jsonObjectOf(text) {
|
|
97
|
+
const start = text.indexOf("{");
|
|
98
|
+
const end = text.lastIndexOf("}");
|
|
99
|
+
if (start === -1 || end <= start)
|
|
100
|
+
return undefined;
|
|
101
|
+
try {
|
|
102
|
+
return JSON.parse(text.slice(start, end + 1));
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -38,8 +38,15 @@ export function pictureKind(body, name) {
|
|
|
38
38
|
// The count is written on a line of its own so the answer can be checked against it when the
|
|
39
39
|
// call runs (`sceneCountOf`), from the saved request alone.
|
|
40
40
|
const countLine = /^Pictures: (\d+)$/m;
|
|
41
|
+
// The thumbnails' scenes come after the images', one per thumbnail, when the thumbnail
|
|
42
|
+
// prompt asks for one with `{{Scene}}`. They are not tied to a stretch of the article: each is
|
|
43
|
+
// the moment that would make someone click, a different one for each thumbnail.
|
|
44
|
+
const thumbnailLine = /^Thumbnails: (\d+)$/m;
|
|
41
45
|
export function sceneMessages(brief) {
|
|
42
46
|
const count = brief.pictures.length;
|
|
47
|
+
const thumbnails = brief.thumbnails ?? 0;
|
|
48
|
+
if (thumbnails > 0)
|
|
49
|
+
return withThumbnails(brief, count, thumbnails);
|
|
43
50
|
return [
|
|
44
51
|
{
|
|
45
52
|
role: "system",
|
|
@@ -63,14 +70,56 @@ export function sceneMessages(brief) {
|
|
|
63
70
|
},
|
|
64
71
|
];
|
|
65
72
|
}
|
|
73
|
+
// How many scenes the answer must hold: the images' and then the thumbnails'.
|
|
66
74
|
export function sceneCountOf(messages) {
|
|
67
75
|
for (const message of messages) {
|
|
68
76
|
const found = countLine.exec(message.content);
|
|
69
77
|
if (found?.[1] !== undefined)
|
|
70
|
-
return Number(found[1]);
|
|
78
|
+
return Number(found[1]) + Number(thumbnailLine.exec(message.content)?.[1] ?? 0);
|
|
71
79
|
}
|
|
72
80
|
return undefined;
|
|
73
81
|
}
|
|
82
|
+
function withThumbnails(brief, count, thumbnails) {
|
|
83
|
+
const total = count + thumbnails;
|
|
84
|
+
const several = thumbnails > 1;
|
|
85
|
+
return [
|
|
86
|
+
{
|
|
87
|
+
role: "system",
|
|
88
|
+
content: [
|
|
89
|
+
count === 0
|
|
90
|
+
? `You plan the thumbnail${several ? "s" : ""} for a narrated video. Read the article and write ${several ? `${String(thumbnails)} thumbnail scenes` : "one thumbnail scene"}.`
|
|
91
|
+
: "You plan the pictures for a narrated video. Read the article and write one scene for each picture listed, in the listed order, and then the thumbnail scenes.",
|
|
92
|
+
...(count === 0
|
|
93
|
+
? []
|
|
94
|
+
: [
|
|
95
|
+
`The pictures are shown in that order while the article is narrated from start to finish. Divide the article into ${String(count)} consecutive stretches of about equal length: scene 1 comes from the first stretch, scene 2 from the second, and so on, so the last picture's scene comes from the ending. Keep to this order even when a later moment would suit a picture better.`,
|
|
96
|
+
"Each picture's scene is one or two sentences saying what the picture shows: the subject, the place, what is happening, and the light and mood. Choose a moment its stretch of the article actually describes, and frame it the way the picture's kind asks (a wide view, a close figure, a moment of action, a mood).",
|
|
97
|
+
"Every picture's scene shows something different: never the same subject or moment twice.",
|
|
98
|
+
]),
|
|
99
|
+
`A thumbnail scene is one or two sentences saying what the thumbnail shows: the video's most recognisable subject in the most striking moment the article describes, the one that would make someone click. It comes from anywhere in the article, not from a stretch.${several ? " Each thumbnail scene shows a different moment or side of the subject, so the thumbnails can be tested against each other." : ""}`,
|
|
100
|
+
"Describe only what can be seen. No text, lettering, captions, labels or logos in the picture, and nothing about art style or medium: the style is set elsewhere.",
|
|
101
|
+
count === 0
|
|
102
|
+
? `Answer with a JSON array of exactly ${String(total)} strings, one per thumbnail, and nothing else.`
|
|
103
|
+
: `Answer with a JSON array of exactly ${String(total)} strings, one scene per picture in order and then ${several ? `the ${String(thumbnails)} thumbnail scenes` : "the thumbnail scene"}, and nothing else.`,
|
|
104
|
+
`Pictures: ${String(count)}`,
|
|
105
|
+
`Thumbnails: ${String(thumbnails)}`,
|
|
106
|
+
].join("\n\n"),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
role: "user",
|
|
110
|
+
content: [
|
|
111
|
+
`Video: ${brief.title}`,
|
|
112
|
+
...(count === 0
|
|
113
|
+
? []
|
|
114
|
+
: [
|
|
115
|
+
`The ${String(count)} pictures, in order:\n${brief.pictures.map((kind, index) => `${String(index + 1)}. ${kind}`).join("\n")}`,
|
|
116
|
+
]),
|
|
117
|
+
`Thumbnails: ${String(thumbnails)}`,
|
|
118
|
+
`Article:\n\n${brief.article}`,
|
|
119
|
+
].join("\n\n"),
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
}
|
|
74
123
|
export function checkScenes(text, count) {
|
|
75
124
|
const fix = "Use Try again; if it keeps happening, choose another model in the Providers section of Edit project.";
|
|
76
125
|
const parsed = z.array(z.string()).safeParse(jsonArrayOf(text));
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { withLanguage } from "../../kernel/ports/languages.js";
|
|
2
|
+
import { appearanceFor, appearanceMessages, appearanceSchema, usesAppearance, withAppearance, } from "../images/appearance.js";
|
|
3
|
+
import { recipe, selectedReference, } from "./recipe-model.js";
|
|
4
|
+
import { llmInput, llmInputFingerprint } from "./recipe-text.js";
|
|
5
|
+
export const imageAppearanceKey = "images:appearance";
|
|
6
|
+
// The prompt bodies a run draws pictures from: the generated images', the thumbnail's when it
|
|
7
|
+
// is drawn from a Library prompt, and the establishing image's.
|
|
8
|
+
function pictureBodies(context) {
|
|
9
|
+
const { config, content } = context;
|
|
10
|
+
const images = config.sources.images === "generate"
|
|
11
|
+
? content.imageOrder.flatMap((key) => {
|
|
12
|
+
const image = content.imageDefinitions[key];
|
|
13
|
+
if (image?.source !== "generate")
|
|
14
|
+
return [];
|
|
15
|
+
return [
|
|
16
|
+
image.templateKey == null
|
|
17
|
+
? image.prompt
|
|
18
|
+
: (content.promptTemplates[image.templateKey] ?? image.prompt),
|
|
19
|
+
];
|
|
20
|
+
})
|
|
21
|
+
: [];
|
|
22
|
+
return [
|
|
23
|
+
...images,
|
|
24
|
+
...(config.sources.thumbnail === "from_prompt"
|
|
25
|
+
? [content.promptTemplates.thumbnailPrompt ?? config.rendered.thumbnailPrompt]
|
|
26
|
+
: []),
|
|
27
|
+
...(config.sources.images === "generate" && config.reference?.source === "prompt"
|
|
28
|
+
? [content.promptTemplates.referencePrompt ?? config.rendered.referencePrompt]
|
|
29
|
+
: []),
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
export function imageAppearance(context, text) {
|
|
33
|
+
const { config } = context;
|
|
34
|
+
if (!pictureBodies(context).some(usesAppearance))
|
|
35
|
+
return undefined;
|
|
36
|
+
const messages = withLanguage(appearanceMessages({ title: config.title, article: text.articleText ?? "" }), config.language);
|
|
37
|
+
const value = recipe(context, imageAppearanceKey, config.sources.images === "generate" ? "images" : "thumbnail", text.articleText === null
|
|
38
|
+
? {
|
|
39
|
+
kind: "deferred",
|
|
40
|
+
version: 1,
|
|
41
|
+
operation: "image-appearance",
|
|
42
|
+
template: [llmInputFingerprint(context, messages), text.article.fingerprint],
|
|
43
|
+
}
|
|
44
|
+
: llmInput(context, messages, true), [text.article.key]);
|
|
45
|
+
return {
|
|
46
|
+
recipe: value,
|
|
47
|
+
value: text.articleText === null ? undefined : savedAppearance(context, value),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// The looks saved for this request, by either fingerprint (see `savedScenes`).
|
|
51
|
+
function savedAppearance(context, value) {
|
|
52
|
+
const logical = context.catalogue === undefined || value.input.kind !== "llm"
|
|
53
|
+
? value.fingerprint
|
|
54
|
+
: recipe({ content: context.content }, value.key, value.stage, { ...value.input, thinkingConfig: null }, value.dependsOn).fingerprint;
|
|
55
|
+
const piece = context.manifest.pieces.find((row) => row.key === value.key &&
|
|
56
|
+
selectedReference(row) &&
|
|
57
|
+
row.piece.state === "done" &&
|
|
58
|
+
(row.fingerprint === value.fingerprint || row.fingerprint === logical));
|
|
59
|
+
if (piece?.piece.payload == null)
|
|
60
|
+
return undefined;
|
|
61
|
+
const payload = JSON.parse(piece.piece.payload);
|
|
62
|
+
const parsed = appearanceSchema.safeParse(payload.appearance);
|
|
63
|
+
return parsed.success ? parsed.data : undefined;
|
|
64
|
+
}
|
|
65
|
+
// A prompt with its looks filled in: the subject's and those of the characters the scene names.
|
|
66
|
+
// Null while the looks are still being looked up, so the picture waits for them.
|
|
67
|
+
export function withLooks(body, appearance, scene, options) {
|
|
68
|
+
if (appearance === undefined || !usesAppearance(body))
|
|
69
|
+
return body;
|
|
70
|
+
if (appearance.value === undefined)
|
|
71
|
+
return null;
|
|
72
|
+
return withAppearance(body, appearanceFor(appearance.value, scene, options));
|
|
73
|
+
}
|
|
74
|
+
// What a picture waiting for the looks adds to its waiting request, and the step it waits on.
|
|
75
|
+
export function lookWait(body, appearance) {
|
|
76
|
+
return appearance === undefined || !usesAppearance(body)
|
|
77
|
+
? { template: [], dependsOn: [] }
|
|
78
|
+
: {
|
|
79
|
+
template: [["appearance", appearance.recipe.fingerprint]],
|
|
80
|
+
dependsOn: [appearance.recipe.key],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { referenceForThumbnail } from "../admission/rules.js";
|
|
2
|
+
import { imageAppearance } from "./recipe-appearance.js";
|
|
2
3
|
import { audioRecipes } from "./recipe-audio.js";
|
|
3
4
|
import { documentRecipes } from "./recipe-document.js";
|
|
4
5
|
import { editPlan } from "./recipe-edit.js";
|
|
@@ -25,13 +26,15 @@ export function buildRecipes(context) {
|
|
|
25
26
|
const exports = exportRecipes(context, audio);
|
|
26
27
|
const captions = exports.find((value) => value.key === "subtitles:files");
|
|
27
28
|
const timing = exports.find((value) => value.key === "subtitles:timing");
|
|
29
|
+
// How the subject and characters look, looked up when a prompt has `{{Appearance}}`.
|
|
30
|
+
const appearance = imageAppearance(context, text);
|
|
28
31
|
// The establishing image, when it is on: every other image is drawn from it.
|
|
29
|
-
const reference = referenceRecipe(context);
|
|
32
|
+
const reference = referenceRecipe(context, appearance);
|
|
30
33
|
const drawnFrom = imageReference(context, reference);
|
|
31
|
-
|
|
32
|
-
const youtube = youtubeRecipes(context, exports);
|
|
33
|
-
// Each image's scene, written from the article, for image prompts that ask for one.
|
|
34
|
+
// Each image's scene, written from the article, and the thumbnails' when their prompt asks.
|
|
34
35
|
const scenes = imageScenes(context, text);
|
|
36
|
+
const thumbnail = thumbnailRecipes(context, text.recipes, referenceForThumbnail(context.config) ? drawnFrom : undefined, scenes, appearance);
|
|
37
|
+
const youtube = youtubeRecipes(context, exports);
|
|
35
38
|
return withReviews(context, [
|
|
36
39
|
...text.recipes,
|
|
37
40
|
...audio.recipes,
|
|
@@ -41,7 +44,8 @@ export function buildRecipes(context) {
|
|
|
41
44
|
...shortsRecipes(context, exports, drawnFrom, audio.cards ?? [], masterPlan(context, audio.levels, "video")),
|
|
42
45
|
...thumbnail,
|
|
43
46
|
...documentRecipes(context, text, thumbnail),
|
|
44
|
-
...visualAssets(context, visualRecipes(context.config, context.content, audio.mediaFingerprint, captions?.fingerprint ?? null, (images) => editPlan(context, exports, youtube, images, audio.cards ?? []), drawnFrom, timing === undefined ? null : resourceIdentity(context, timing), withLines(masterPlan(context, audio.levels, "video"), linePlan(context, timing)), scenes)),
|
|
47
|
+
...visualAssets(context, visualRecipes(context.config, context.content, audio.mediaFingerprint, captions?.fingerprint ?? null, (images) => editPlan(context, exports, youtube, images, audio.cards ?? []), drawnFrom, timing === undefined ? null : resourceIdentity(context, timing), withLines(masterPlan(context, audio.levels, "video"), linePlan(context, timing)), scenes, appearance)),
|
|
45
48
|
...(scenes === undefined ? [] : [scenes.recipe]),
|
|
49
|
+
...(appearance === undefined ? [] : [appearance.recipe]),
|
|
46
50
|
]);
|
|
47
51
|
}
|
|
@@ -47,6 +47,8 @@ export const deferredOperations = [
|
|
|
47
47
|
// Scenes from the article (`recipe-scenes.ts`): the scenes step and each image waiting on it.
|
|
48
48
|
"image-scenes",
|
|
49
49
|
"image-scene",
|
|
50
|
+
// How the subject and characters look (`recipe-appearance.ts`), looked up on the web.
|
|
51
|
+
"image-appearance",
|
|
50
52
|
];
|
|
51
53
|
export function recipe(context, key, stage, input, dependsOn = [], options = {}) {
|
|
52
54
|
const requestFingerprint = input.kind === "tts" && input.dialogue !== undefined
|
|
@@ -34,7 +34,8 @@ export function recipeProviderChoice(recipe, config) {
|
|
|
34
34
|
return undefined;
|
|
35
35
|
const family = input.operation === "narration-preparation" ||
|
|
36
36
|
input.operation === "narration-description" ||
|
|
37
|
-
input.operation === "image-scenes"
|
|
37
|
+
input.operation === "image-scenes" ||
|
|
38
|
+
input.operation === "image-appearance"
|
|
38
39
|
? "llm"
|
|
39
40
|
: recipe.stage === "audio"
|
|
40
41
|
? "tts"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { referenceKey } from "../admission/model.js";
|
|
2
2
|
import { usesReference } from "../admission/rules.js";
|
|
3
|
+
import { lookWait, withLooks } from "./recipe-appearance.js";
|
|
3
4
|
import { castFor } from "./recipe-cast.js";
|
|
4
5
|
import { recipe, selectedAsset, } from "./recipe-model.js";
|
|
5
6
|
import { renderedPrompt } from "./recipe-text.js";
|
|
@@ -16,7 +17,9 @@ export function imageChoice(config) {
|
|
|
16
17
|
...(config.images?.thinking === undefined ? {} : { thinking: config.images.thinking }),
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
|
-
export function referenceRecipe(context
|
|
20
|
+
export function referenceRecipe(context,
|
|
21
|
+
// How the subject looks, for an establishing prompt with `{{Appearance}}`.
|
|
22
|
+
appearance) {
|
|
20
23
|
const { config, content } = context;
|
|
21
24
|
if (!usesReference(config) || config.reference === undefined)
|
|
22
25
|
return undefined;
|
|
@@ -27,7 +30,24 @@ export function referenceRecipe(context) {
|
|
|
27
30
|
assetId: content.provided.reference ?? null,
|
|
28
31
|
semantic: "reference",
|
|
29
32
|
}, [], { unresolved: content.provided.reference === undefined });
|
|
30
|
-
const
|
|
33
|
+
const written = renderedPrompt(context, referencePromptKey);
|
|
34
|
+
const prompt = withLooks(written, appearance);
|
|
35
|
+
if (prompt === null) {
|
|
36
|
+
const wait = lookWait(written, appearance);
|
|
37
|
+
return recipe(context, referenceKey, "images", {
|
|
38
|
+
kind: "deferred",
|
|
39
|
+
version: 1,
|
|
40
|
+
operation: "image-scene",
|
|
41
|
+
template: [
|
|
42
|
+
...wait.template,
|
|
43
|
+
written,
|
|
44
|
+
config.images?.provider ?? null,
|
|
45
|
+
config.images?.model ?? null,
|
|
46
|
+
config.format,
|
|
47
|
+
...(config.images?.thinking === undefined ? [] : [config.images.thinking]),
|
|
48
|
+
],
|
|
49
|
+
}, wait.dependsOn);
|
|
50
|
+
}
|
|
31
51
|
return recipe(context, referenceKey, "images", {
|
|
32
52
|
kind: "image",
|
|
33
53
|
version: 1,
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { withLanguage } from "../../kernel/ports/languages.js";
|
|
3
|
-
import {
|
|
3
|
+
import { thumbnailCountOf } from "../admission/model.js";
|
|
4
|
+
import { pictureKind, sceneMessages, usesScene } from "../images/scenes.js";
|
|
4
5
|
import { recipe, selectedReference, } from "./recipe-model.js";
|
|
5
6
|
import { llmInput, llmInputFingerprint } from "./recipe-text.js";
|
|
7
|
+
// A thumbnail drawn from a Library prompt whose text asks for `{{Scene}}` takes one scene per
|
|
8
|
+
// thumbnail; any other thumbnail is drawn as it always was.
|
|
9
|
+
export function thumbnailScenes(context) {
|
|
10
|
+
const { config, content } = context;
|
|
11
|
+
if (config.sources.thumbnail !== "from_prompt")
|
|
12
|
+
return 0;
|
|
13
|
+
const body = content.promptTemplates.thumbnailPrompt ?? config.rendered.thumbnailPrompt;
|
|
14
|
+
return usesScene(body) ? thumbnailCountOf(config) : 0;
|
|
15
|
+
}
|
|
6
16
|
export const imageScenesKey = "images:scenes";
|
|
7
17
|
export function imageScenes(context, text) {
|
|
8
18
|
const { config, content } = context;
|
|
@@ -24,9 +34,15 @@ export function imageScenes(context, text) {
|
|
|
24
34
|
keys.push(key);
|
|
25
35
|
pictures.push(pictureKind(body, name));
|
|
26
36
|
}
|
|
27
|
-
|
|
37
|
+
const thumbnailCount = thumbnailScenes(context);
|
|
38
|
+
if (keys.length === 0 && thumbnailCount === 0)
|
|
28
39
|
return undefined;
|
|
29
|
-
const messages = withLanguage(sceneMessages({
|
|
40
|
+
const messages = withLanguage(sceneMessages({
|
|
41
|
+
title: config.title,
|
|
42
|
+
article: text.articleText ?? "",
|
|
43
|
+
pictures,
|
|
44
|
+
...(thumbnailCount === 0 ? {} : { thumbnails: thumbnailCount }),
|
|
45
|
+
}), config.language);
|
|
30
46
|
const value = recipe(context, imageScenesKey, "images", text.articleText === null
|
|
31
47
|
? {
|
|
32
48
|
kind: "deferred",
|
|
@@ -35,10 +51,15 @@ export function imageScenes(context, text) {
|
|
|
35
51
|
template: [llmInputFingerprint(context, messages), text.article.fingerprint],
|
|
36
52
|
}
|
|
37
53
|
: llmInput(context, messages), [text.article.key]);
|
|
54
|
+
const saved = text.articleText === null
|
|
55
|
+
? undefined
|
|
56
|
+
: savedScenes(context, value, keys.length + thumbnailCount);
|
|
38
57
|
return {
|
|
39
58
|
recipe: value,
|
|
40
59
|
keys,
|
|
41
|
-
scenes:
|
|
60
|
+
scenes: saved?.slice(0, keys.length),
|
|
61
|
+
thumbnailCount,
|
|
62
|
+
thumbnails: saved?.slice(keys.length),
|
|
42
63
|
};
|
|
43
64
|
}
|
|
44
65
|
// The scenes saved for this request. The request carries the model's thinking settings from
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { narrationPreparationFields, shortsFields, usesNarrationPreparation, usesReference, usesShorts, usesYoutubeDescription, videoEditFields, youtubeDescriptionFields, } from "../admission/rules.js";
|
|
2
|
-
import { detectSlots,
|
|
2
|
+
import { detectSlots, filledKeywords, render } from "../admission/substitute.js";
|
|
3
3
|
import { imagesPerVideoMax } from "../images/scale.js";
|
|
4
4
|
import { loudnessFields } from "../loudness/model.js";
|
|
5
5
|
import { pauseFields } from "../narration/pauses-model.js";
|
|
@@ -143,7 +143,7 @@ export function validateRecipeInputs(config, content) {
|
|
|
143
143
|
if (slots.errors.length > 0)
|
|
144
144
|
fields.push({ field: prompt.field, message: "Fix the keyword placeholders in this prompt." });
|
|
145
145
|
for (const key of slots.names)
|
|
146
|
-
if (key
|
|
146
|
+
if (!filledKeywords.includes(key) &&
|
|
147
147
|
(!Object.hasOwn(config.values, key) || !config.values[key]?.trim()))
|
|
148
148
|
fields.push({ field: `values.${key}`, message: "Enter a value for this keyword." });
|
|
149
149
|
}
|