@gentbajko/slopify 2.0.2 → 2.0.3
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/adapters/alignment/protocol.js +11 -1
- package/dist/adapters/alignment/runner.js +4 -1
- package/dist/adapters/alignment/worker.js +28 -5
- package/dist/adapters/explain.js +93 -0
- package/dist/adapters/ffmpeg.js +3 -3
- package/dist/adapters/host-cli/index.js +9 -2
- package/dist/adapters/host-cli/transport.js +4 -4
- package/dist/adapters/image/bytes.js +2 -2
- package/dist/adapters/image/codex-output.js +12 -12
- package/dist/adapters/image/codex.js +24 -8
- package/dist/adapters/image/fal.js +12 -6
- package/dist/adapters/image/google.js +18 -8
- package/dist/adapters/image/models.js +8 -2
- package/dist/adapters/image/openai.js +15 -6
- package/dist/adapters/image/replicate.js +16 -7
- package/dist/adapters/llm/claude-code-models.js +1 -1
- package/dist/adapters/llm/claude-code.js +16 -7
- package/dist/adapters/llm/cli-login-error.js +2 -1
- package/dist/adapters/llm/codex-models.js +1 -1
- package/dist/adapters/llm/codex.js +5 -6
- package/dist/adapters/llm/document-workspace.js +2 -2
- package/dist/adapters/llm/gemini-models.js +1 -1
- package/dist/adapters/llm/gemini-workspace.js +1 -1
- package/dist/adapters/llm/gemini.js +15 -11
- package/dist/adapters/llm/openrouter.js +21 -9
- package/dist/adapters/llm/run-cli.js +14 -11
- package/dist/adapters/tts/cartesia.js +10 -3
- package/dist/adapters/tts/elevenlabs.js +18 -6
- package/dist/adapters/tts/inworld-async.js +47 -16
- package/dist/adapters/tts/inworld.js +25 -15
- package/dist/adapters/tts/openai.js +18 -6
- package/dist/catalog/registry.js +13 -10
- package/dist/catalog/store.js +1 -1
- package/dist/catalog/validate.js +13 -4
- package/dist/edge/cli.js +33 -7
- package/dist/edge/docker-launch.js +6 -6
- package/dist/edge/docker-projects/engine.js +34 -13
- package/dist/edge/docker-projects/install.js +8 -8
- package/dist/edge/docker-projects/state.js +6 -6
- package/dist/edge/docker-projects/tree.js +6 -6
- package/dist/edge/docker.js +13 -13
- package/dist/edge/http/actions.js +27 -25
- package/dist/edge/http/app.js +3 -3
- package/dist/edge/http/audio-preview.js +1 -1
- package/dist/edge/http/checkpoints.js +5 -1
- package/dist/edge/http/diagnostics.js +3 -1
- package/dist/edge/http/draft-files.js +2 -2
- package/dist/edge/http/draft-problem.js +11 -1
- package/dist/edge/http/files.js +4 -4
- package/dist/edge/http/folder-location.js +3 -3
- package/dist/edge/http/fonts.js +22 -10
- package/dist/edge/http/host-cli.js +34 -12
- package/dist/edge/http/multipart.js +7 -5
- package/dist/edge/http/open-folder.js +2 -2
- package/dist/edge/http/planning.js +4 -4
- package/dist/edge/http/problem.js +2 -2
- package/dist/edge/http/project-templates.js +7 -3
- package/dist/edge/http/projects.js +8 -8
- package/dist/edge/http/prompts.js +9 -4
- package/dist/edge/http/providers.js +15 -7
- package/dist/edge/http/revision-files.js +3 -3
- package/dist/edge/http/revisions.js +30 -4
- package/dist/edge/http/schedules.js +9 -9
- package/dist/edge/http/settings.js +15 -9
- package/dist/edge/http/staging.js +5 -5
- package/dist/edge/http/storage.js +4 -4
- package/dist/edge/http/subtitles.js +1 -1
- package/dist/edge/http/tutorial.js +2 -2
- package/dist/edge/http/update.js +3 -3
- package/dist/host-cli/install.js +28 -6
- package/dist/host-cli/paths.js +6 -6
- package/dist/host-cli/server.js +1 -1
- package/dist/host-cli/service.js +11 -11
- package/dist/host-cli/status.js +7 -3
- package/dist/kernel/config/index.js +6 -4
- package/dist/kernel/db/migrate.js +2 -1
- package/dist/kernel/db/migrations/0013-schedule-topic-queue.sql +4 -0
- package/dist/kernel/lock.js +4 -3
- package/dist/kernel/ports/subtitles.js +15 -1
- package/dist/kernel/runner/attempt.js +26 -2
- package/dist/main.js +2 -2
- package/dist/slices/admission/rules.js +32 -20
- package/dist/slices/article/continuation.js +4 -2
- package/dist/slices/article/plain.js +2 -2
- package/dist/slices/article/provided-entries.js +3 -3
- package/dist/slices/article/run.js +2 -2
- package/dist/slices/article/segments.js +5 -3
- package/dist/slices/control/providers.js +20 -7
- package/dist/slices/fonts/catalog.js +1 -1
- package/dist/slices/fonts/upload.js +1 -1
- package/dist/slices/images/run.js +5 -5
- package/dist/slices/library/lint.js +13 -7
- package/dist/slices/library/slots.js +2 -2
- package/dist/slices/narration/concat.js +1 -1
- package/dist/slices/narration/pronunciation-chunks.js +3 -3
- package/dist/slices/narration/pronunciation.js +2 -2
- package/dist/slices/narration/run.js +7 -7
- package/dist/slices/narration/steering.js +3 -3
- package/dist/slices/play-drafts/convert.js +5 -4
- package/dist/slices/play-drafts/readiness.js +12 -6
- package/dist/slices/play-drafts/review-inputs.js +7 -4
- package/dist/slices/play-drafts/review.js +3 -3
- package/dist/slices/play-drafts/service.js +3 -1
- package/dist/slices/play-drafts/uploads.js +1 -1
- package/dist/slices/rebuild/admission-repo.js +2 -2
- package/dist/slices/rebuild/recipe-legacy.js +1 -1
- package/dist/slices/rebuild/recipe-narration-text.js +1 -1
- package/dist/slices/rebuild/recipe-visual.js +1 -1
- package/dist/slices/rebuild/recovery.js +2 -2
- package/dist/slices/rebuild/repo.js +3 -3
- package/dist/slices/rebuild/runtime-admission.js +4 -4
- package/dist/slices/rebuild/runtime-article.js +5 -5
- package/dist/slices/rebuild/runtime-checkpoints.js +4 -4
- package/dist/slices/rebuild/runtime-export-inputs.js +6 -6
- package/dist/slices/rebuild/runtime-export.js +4 -4
- package/dist/slices/rebuild/runtime-local.js +6 -6
- package/dist/slices/rebuild/runtime-narration-text.js +46 -7
- package/dist/slices/rebuild/runtime-piece-label.js +62 -0
- package/dist/slices/rebuild/runtime-provider.js +6 -4
- package/dist/slices/rebuild/runtime-publication.js +3 -3
- package/dist/slices/rebuild/runtime-run.js +11 -1
- package/dist/slices/rebuild/runtime-subtitles.js +78 -15
- package/dist/slices/rebuild/transition-repo.js +6 -6
- package/dist/slices/reruns/index.js +1 -1
- package/dist/slices/research/run.js +9 -7
- package/dist/slices/research/synthesis.js +4 -2
- package/dist/slices/revisions/mutation-assets.js +26 -8
- package/dist/slices/revisions/mutation-cues.js +1 -1
- package/dist/slices/revisions/rules.js +18 -9
- package/dist/slices/revisions/schema.js +1 -1
- package/dist/slices/schedules/repo.js +55 -11
- package/dist/slices/schedules/scheduler.js +25 -8
- package/dist/slices/schedules/schema.js +19 -4
- package/dist/slices/schedules/service.js +2 -0
- package/dist/slices/settings/cli-paths.js +7 -4
- package/dist/slices/settings/models.js +4 -4
- package/dist/slices/settings/playback.js +2 -2
- package/dist/slices/storage/assets.js +5 -5
- package/dist/slices/storage/layout.js +1 -1
- package/dist/slices/subtitles/captions.js +1 -1
- package/dist/slices/subtitles/prepare.js +5 -5
- package/dist/slices/subtitles/transcript.js +1 -1
- package/dist/slices/thumbnail/run.js +8 -8
- package/dist/slices/video/audio-inputs.js +2 -2
- package/dist/slices/video/ffmpeg.js +6 -4
- package/dist/slices/video/plan.js +1 -1
- package/dist/slices/video/run.js +2 -2
- package/dist/updater/plan.js +1 -1
- package/dist/updater/service.js +4 -3
- package/dist/updater/worker.js +6 -4
- package/dist/web/assets/{index-CZNiHm8P.css → index-Bwtmu9ei.css} +1 -1
- package/dist/web/assets/index-DjhMJqMN.js +141 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-DPgGLX5m.js +0 -137
|
@@ -51,16 +51,25 @@ export function validateCues(cues, duration) {
|
|
|
51
51
|
for (const [index, cue] of cues.entries()) {
|
|
52
52
|
const field = `content.subtitleCues.cues.${index}`;
|
|
53
53
|
if (seen.has(cue.id))
|
|
54
|
-
fields.push({
|
|
54
|
+
fields.push({
|
|
55
|
+
field: `${field}.id`,
|
|
56
|
+
message: "Two captions have the same ID. Reload the page and edit the captions again.",
|
|
57
|
+
});
|
|
55
58
|
seen.add(cue.id);
|
|
56
59
|
if (cue.text.trim() === "")
|
|
57
|
-
fields.push({
|
|
60
|
+
fields.push({
|
|
61
|
+
field: `${field}.text`,
|
|
62
|
+
message: "Enter the caption text, or delete this caption.",
|
|
63
|
+
});
|
|
58
64
|
if (!Number.isFinite(cue.start) || cue.start < end)
|
|
59
|
-
fields.push({
|
|
65
|
+
fields.push({
|
|
66
|
+
field: `${field}.start`,
|
|
67
|
+
message: "This caption must start after the previous one ends.",
|
|
68
|
+
});
|
|
60
69
|
if (!Number.isFinite(cue.end) || cue.end <= cue.start || cue.end > duration)
|
|
61
70
|
fields.push({
|
|
62
71
|
field: `${field}.end`,
|
|
63
|
-
message: "
|
|
72
|
+
message: "This caption must end after it starts and before the narration ends.",
|
|
64
73
|
});
|
|
65
74
|
end = cue.end;
|
|
66
75
|
}
|
|
@@ -75,7 +84,7 @@ export function validateTemplateIntent(base, edit) {
|
|
|
75
84
|
base.revision.config.rendered[key] === edit.config.rendered[key])
|
|
76
85
|
fields.push({
|
|
77
86
|
field: `content.promptTemplates.${key}`,
|
|
78
|
-
message: "
|
|
87
|
+
message: "This prompt was edited by hand, so new keywords will not change it. Switch it back to its template, or choose to keep your edited prompt, first.",
|
|
79
88
|
});
|
|
80
89
|
}
|
|
81
90
|
for (const [key, image] of Object.entries(base.revision.content.imageDefinitions)) {
|
|
@@ -87,7 +96,7 @@ export function validateTemplateIntent(base, edit) {
|
|
|
87
96
|
next.prompt === image.prompt)
|
|
88
97
|
fields.push({
|
|
89
98
|
field: `content.imageDefinitions.${key}.templateKey`,
|
|
90
|
-
message: "
|
|
99
|
+
message: "This image prompt was edited by hand, so new keywords will not change it. Switch it back to its template, or choose to keep your edited prompt, first.",
|
|
91
100
|
});
|
|
92
101
|
}
|
|
93
102
|
}
|
|
@@ -99,7 +108,7 @@ export function validateTemplateIntent(base, edit) {
|
|
|
99
108
|
isDeepStrictEqual(base.revision.content.imageDefinitions[key], image)))
|
|
100
109
|
fields.push({
|
|
101
110
|
field: `content.imageDefinitions.${key}.templateKey`,
|
|
102
|
-
message: "The
|
|
111
|
+
message: "The prompt template this image uses is missing. Choose another image prompt.",
|
|
103
112
|
});
|
|
104
113
|
return fields;
|
|
105
114
|
}
|
|
@@ -132,13 +141,13 @@ export function validateNarrationIntent(base, edit) {
|
|
|
132
141
|
if (!isDeepStrictEqual(value, base.revision.content.narrationOverrides[key]) && !keys.has(key))
|
|
133
142
|
fields.push({
|
|
134
143
|
field: `content.narrationOverrides.${key}`,
|
|
135
|
-
message: "
|
|
144
|
+
message: "This narration part no longer exists. Reload the page and choose again.",
|
|
136
145
|
});
|
|
137
146
|
for (const [index, upload] of (edit.uploads ?? []).entries())
|
|
138
147
|
if (upload.destination.kind === "narration" && !keys.has(upload.destination.key))
|
|
139
148
|
fields.push({
|
|
140
149
|
field: `uploads.${index}.destination.key`,
|
|
141
|
-
message: "
|
|
150
|
+
message: "This narration part no longer exists. Reload the page and choose again.",
|
|
142
151
|
});
|
|
143
152
|
return fields;
|
|
144
153
|
}
|
|
@@ -15,6 +15,8 @@ const rowSchema = z.object({
|
|
|
15
15
|
overlap_policy: z.string(),
|
|
16
16
|
spend_limit_cents: z.number().nullable(),
|
|
17
17
|
items_json: z.string(),
|
|
18
|
+
topic_keyword: z.string().nullable(),
|
|
19
|
+
values_json: z.string(),
|
|
18
20
|
status: z.string(),
|
|
19
21
|
version: z.number(),
|
|
20
22
|
next_run_at: z.string().nullable(),
|
|
@@ -25,7 +27,7 @@ const rowSchema = z.object({
|
|
|
25
27
|
export function scheduleById(db, id) {
|
|
26
28
|
const row = db
|
|
27
29
|
.prepare(`SELECT id,name,template_id,template_version,cadence_json,timezone,missed_policy,
|
|
28
|
-
overlap_policy,spend_limit_cents,items_json,status,version,next_run_at,created_at,updated_at,
|
|
30
|
+
overlap_policy,spend_limit_cents,items_json,topic_keyword,values_json,status,version,next_run_at,created_at,updated_at,
|
|
29
31
|
deleted_at
|
|
30
32
|
FROM schedules WHERE id=?`)
|
|
31
33
|
.get(id);
|
|
@@ -34,7 +36,7 @@ export function scheduleById(db, id) {
|
|
|
34
36
|
export function scheduleRows(db) {
|
|
35
37
|
return db
|
|
36
38
|
.prepare(`SELECT id,name,template_id,template_version,cadence_json,timezone,missed_policy,
|
|
37
|
-
overlap_policy,spend_limit_cents,items_json,status,version,next_run_at,created_at,updated_at,
|
|
39
|
+
overlap_policy,spend_limit_cents,items_json,topic_keyword,values_json,status,version,next_run_at,created_at,updated_at,
|
|
38
40
|
deleted_at
|
|
39
41
|
FROM schedules ORDER BY created_at DESC,id`)
|
|
40
42
|
.all()
|
|
@@ -43,7 +45,7 @@ export function scheduleRows(db) {
|
|
|
43
45
|
export function dueSchedules(db, now) {
|
|
44
46
|
return db
|
|
45
47
|
.prepare(`SELECT id,name,template_id,template_version,cadence_json,timezone,missed_policy,
|
|
46
|
-
overlap_policy,spend_limit_cents,items_json,status,version,next_run_at,created_at,updated_at,
|
|
48
|
+
overlap_policy,spend_limit_cents,items_json,topic_keyword,values_json,status,version,next_run_at,created_at,updated_at,
|
|
47
49
|
deleted_at
|
|
48
50
|
FROM schedules WHERE deleted_at IS NULL AND status='active' AND next_run_at IS NOT NULL
|
|
49
51
|
AND next_run_at <= ?
|
|
@@ -54,17 +56,18 @@ export function dueSchedules(db, now) {
|
|
|
54
56
|
export function insertSchedule(db, schedule, creationHash) {
|
|
55
57
|
db.prepare(`INSERT INTO schedules
|
|
56
58
|
(id,name,template_id,template_version,cadence_json,timezone,missed_policy,overlap_policy,
|
|
57
|
-
spend_limit_cents,items_json,status,version,creation_hash,
|
|
58
|
-
deleted_at)
|
|
59
|
-
VALUES (
|
|
59
|
+
spend_limit_cents,items_json,topic_keyword,values_json,status,version,creation_hash,
|
|
60
|
+
next_run_at,created_at,updated_at,deleted_at)
|
|
61
|
+
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`).run(schedule.id, schedule.name, schedule.templateId, schedule.templateVersion, JSON.stringify(schedule.cadence), schedule.timezone, schedule.missedPolicy, schedule.overlapPolicy, schedule.spendLimitCents, JSON.stringify(schedule.items), schedule.topicKeyword, JSON.stringify(schedule.values), schedule.status, schedule.version, creationHash, schedule.nextRunAt, schedule.createdAt, schedule.updatedAt, schedule.deletedAt);
|
|
60
62
|
}
|
|
61
63
|
export function updateScheduleRow(db, schedule, mutationId, mutationHash, baseVersion) {
|
|
62
64
|
const changed = db
|
|
63
65
|
.prepare(`UPDATE schedules SET name=?,template_id=?,template_version=?,cadence_json=?,timezone=?,
|
|
64
|
-
missed_policy=?,overlap_policy=?,spend_limit_cents=?,items_json=?,
|
|
66
|
+
missed_policy=?,overlap_policy=?,spend_limit_cents=?,items_json=?,topic_keyword=?,
|
|
67
|
+
values_json=?,status=?,version=?,
|
|
65
68
|
next_run_at=?,updated_at=?,mutation_id=?,mutation_hash=?
|
|
66
69
|
WHERE id=? AND version=? AND deleted_at IS NULL`)
|
|
67
|
-
.run(schedule.name, schedule.templateId, schedule.templateVersion, JSON.stringify(schedule.cadence), schedule.timezone, schedule.missedPolicy, schedule.overlapPolicy, schedule.spendLimitCents, JSON.stringify(schedule.items), schedule.status, schedule.version, schedule.nextRunAt, schedule.updatedAt, mutationId, mutationHash, schedule.id, baseVersion);
|
|
70
|
+
.run(schedule.name, schedule.templateId, schedule.templateVersion, JSON.stringify(schedule.cadence), schedule.timezone, schedule.missedPolicy, schedule.overlapPolicy, schedule.spendLimitCents, JSON.stringify(schedule.items), schedule.topicKeyword, JSON.stringify(schedule.values), schedule.status, schedule.version, schedule.nextRunAt, schedule.updatedAt, mutationId, mutationHash, schedule.id, baseVersion);
|
|
68
71
|
return Number(changed.changes) === 1;
|
|
69
72
|
}
|
|
70
73
|
export function tombstoneScheduleRow(db, id, version, deletedAt) {
|
|
@@ -108,8 +111,14 @@ export function recordRunStartIdentity(db, run) {
|
|
|
108
111
|
if (Number(changed.changes) !== 1)
|
|
109
112
|
throw new Error("The scheduled run could not persist its Start identity.");
|
|
110
113
|
}
|
|
111
|
-
|
|
114
|
+
// `used` is the queued topic the run started, removed in the same transaction that records
|
|
115
|
+
// the run's projects. It is matched by value rather than position, so an edit saved while the
|
|
116
|
+
// run was starting cannot make it remove a different topic. The run that empties the queue
|
|
117
|
+
// completes the schedule.
|
|
118
|
+
export function recordRunDispatch(db, run, recordedAt, used) {
|
|
112
119
|
transact(db, () => {
|
|
120
|
+
if (used !== undefined)
|
|
121
|
+
consumeTopic(db, run.scheduleId, used, recordedAt);
|
|
113
122
|
const changed = db
|
|
114
123
|
.prepare(`UPDATE schedule_runs SET request_id=?,project_ids_json=?,estimate_json=?
|
|
115
124
|
WHERE id=? AND status='running'`)
|
|
@@ -120,6 +129,19 @@ export function recordRunDispatch(db, run, recordedAt) {
|
|
|
120
129
|
settleScheduleRunsForProject(db, projectId, recordedAt);
|
|
121
130
|
});
|
|
122
131
|
}
|
|
132
|
+
function consumeTopic(db, scheduleId, used, updatedAt) {
|
|
133
|
+
const schedule = scheduleById(db, scheduleId);
|
|
134
|
+
if (schedule === undefined || schedule.deletedAt !== null)
|
|
135
|
+
return;
|
|
136
|
+
const key = JSON.stringify(used);
|
|
137
|
+
const at = schedule.items.findIndex((item) => JSON.stringify(item) === key);
|
|
138
|
+
if (at === -1)
|
|
139
|
+
return;
|
|
140
|
+
const items = schedule.items.filter((_item, index) => index !== at);
|
|
141
|
+
const done = items.length === 0 && (schedule.status === "active" || schedule.status === "paused");
|
|
142
|
+
db.prepare(`UPDATE schedules SET items_json=?,status=?,next_run_at=?,version=version+1,updated_at=?
|
|
143
|
+
WHERE id=? AND deleted_at IS NULL`).run(JSON.stringify(items), done ? "completed" : schedule.status, done ? null : schedule.nextRunAt, updatedAt, scheduleId);
|
|
144
|
+
}
|
|
123
145
|
export function runsForSchedule(db, scheduleId) {
|
|
124
146
|
return db
|
|
125
147
|
.prepare(`SELECT id,schedule_id,scheduled_for,status,request_id,project_ids_json,estimate_json,
|
|
@@ -200,7 +222,7 @@ function projectIsActive(db, projectId) {
|
|
|
200
222
|
const state = derive(stagesOf(db, projectId), projectPaused(db, projectId));
|
|
201
223
|
return state !== "done" && state !== "failed" && state !== "canceled";
|
|
202
224
|
}
|
|
203
|
-
export function recoverRunningRuns(db, endedAt, error = "
|
|
225
|
+
export function recoverRunningRuns(db, endedAt, error = "Slopify was closed while this run was in progress. Check its video in Projects; the next run will go ahead as planned.") {
|
|
204
226
|
return transact(db, () => {
|
|
205
227
|
const pending = db
|
|
206
228
|
.prepare(`SELECT id,request_id FROM schedule_runs
|
|
@@ -243,6 +265,8 @@ function parseSchedule(row) {
|
|
|
243
265
|
overlapPolicy: value.overlap_policy,
|
|
244
266
|
spendLimitCents: value.spend_limit_cents,
|
|
245
267
|
items: JSON.parse(value.items_json),
|
|
268
|
+
topicKeyword: value.topic_keyword,
|
|
269
|
+
values: JSON.parse(value.values_json),
|
|
246
270
|
status: value.status,
|
|
247
271
|
version: value.version,
|
|
248
272
|
nextRunAt: value.next_run_at,
|
|
@@ -276,6 +300,26 @@ function parseRun(row) {
|
|
|
276
300
|
estimate: value.estimate_json === null ? null : JSON.parse(value.estimate_json),
|
|
277
301
|
startedAt: value.started_at,
|
|
278
302
|
endedAt: value.ended_at,
|
|
279
|
-
error: value.error,
|
|
303
|
+
error: value.error === null ? null : runErrorText(value.error),
|
|
280
304
|
});
|
|
281
305
|
}
|
|
306
|
+
// A failed dispatch records the refusal's reason code; the run history shows the sentence.
|
|
307
|
+
// Mapped on read so runs recorded before these sentences existed read the same way.
|
|
308
|
+
const internalRunError = "Slopify hit an internal error while starting this run. The next run will try again; if it keeps happening, use Download diagnostics in Settings and report it.";
|
|
309
|
+
const runErrors = {
|
|
310
|
+
"missing-template": "The template this schedule uses was deleted or changed. Edit the schedule and choose a template again.",
|
|
311
|
+
"unsupported-media": "This template uses audio, images or a thumbnail you supplied, which scheduled runs cannot use. Pick a template that generates these instead.",
|
|
312
|
+
"spend-limit": "Not started: the estimated cost was above this schedule's spend limit, or some prices were unknown. Raise the spend limit or choose models with known prices.",
|
|
313
|
+
readiness: "Not started: a provider was not ready, for example a missing API key, model or voice. Check Settings → Providers; the next run will try again.",
|
|
314
|
+
"not-found": "The template's settings are no longer valid, for example a prompt or voice it uses was deleted. Fix the template in Library > Templates and save it.",
|
|
315
|
+
"invalid-draft": "The template's settings are no longer valid, for example a prompt or voice it uses was deleted. Fix the template in Library > Templates and save it.",
|
|
316
|
+
"invalid-edit": "The template's settings are no longer valid, for example a prompt or voice it uses was deleted. Fix the template in Library > Templates and save it.",
|
|
317
|
+
conflict: internalRunError,
|
|
318
|
+
"pending-start": internalRunError,
|
|
319
|
+
"already-started": internalRunError,
|
|
320
|
+
"stale-review": internalRunError,
|
|
321
|
+
"The scheduled run failed.": internalRunError,
|
|
322
|
+
};
|
|
323
|
+
function runErrorText(error) {
|
|
324
|
+
return Object.hasOwn(runErrors, error) ? (runErrors[error] ?? error) : error;
|
|
325
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { transact } from "../../kernel/db/tx.js";
|
|
2
|
+
import { render } from "../admission/substitute.js";
|
|
2
3
|
import { reviewDraft } from "../play-drafts/review.js";
|
|
3
4
|
import { createDraft } from "../play-drafts/service.js";
|
|
4
5
|
import { startPlayDraft } from "../play-drafts/start.js";
|
|
@@ -59,8 +60,8 @@ function claim(deps, schedule, now) {
|
|
|
59
60
|
endedAt: skip ? now.toISOString() : null,
|
|
60
61
|
error: skip
|
|
61
62
|
? overlapping
|
|
62
|
-
? "Skipped because
|
|
63
|
-
: "Skipped because
|
|
63
|
+
? "Skipped because the previous run of this schedule was still going."
|
|
64
|
+
: "Skipped because Slopify was not running at the scheduled time."
|
|
64
65
|
: null,
|
|
65
66
|
};
|
|
66
67
|
if (!insertRun(deps.db, run))
|
|
@@ -81,13 +82,11 @@ async function execute(deps, claimed) {
|
|
|
81
82
|
id: claimed.schedule.templateId,
|
|
82
83
|
version: claimed.schedule.templateVersion,
|
|
83
84
|
});
|
|
85
|
+
const topic = claimed.schedule.items[0];
|
|
84
86
|
const fresh = {
|
|
85
87
|
...document,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
title: item.title,
|
|
89
|
-
values: item.values,
|
|
90
|
-
})),
|
|
88
|
+
form: runForm(document.form, claimed.schedule, topic),
|
|
89
|
+
variants: [],
|
|
91
90
|
};
|
|
92
91
|
const draft = createDraft(deps, { id: deps.uuid(), document: fresh });
|
|
93
92
|
if (!draft.ok)
|
|
@@ -118,7 +117,7 @@ async function execute(deps, claimed) {
|
|
|
118
117
|
requestId: started.value.requestId,
|
|
119
118
|
projectIds: started.value.projectIds,
|
|
120
119
|
};
|
|
121
|
-
recordRunDispatch(deps.db, run, deps.clock.now().toISOString());
|
|
120
|
+
recordRunDispatch(deps.db, run, deps.clock.now().toISOString(), topic);
|
|
122
121
|
run = {
|
|
123
122
|
...run,
|
|
124
123
|
status: "succeeded",
|
|
@@ -135,6 +134,24 @@ async function execute(deps, claimed) {
|
|
|
135
134
|
}
|
|
136
135
|
updateRun(deps.db, run);
|
|
137
136
|
}
|
|
137
|
+
// One project per run. The first queued topic fills the chosen keyword, the schedule's fixed
|
|
138
|
+
// values fill the rest over the template's own, and the template's title is filled from the
|
|
139
|
+
// same keywords, so "D&D Lore: {{Topic}}" names the project after the topic. A topic saved
|
|
140
|
+
// before topics had a keyword brings its own title and values instead.
|
|
141
|
+
function runForm(form, schedule, topic) {
|
|
142
|
+
const values = {
|
|
143
|
+
...form.values,
|
|
144
|
+
...schedule.values,
|
|
145
|
+
...(topic?.values ?? {}),
|
|
146
|
+
...(topic !== undefined && schedule.topicKeyword !== null
|
|
147
|
+
? { [schedule.topicKeyword]: topic.title }
|
|
148
|
+
: {}),
|
|
149
|
+
};
|
|
150
|
+
const title = topic !== undefined && schedule.topicKeyword === null
|
|
151
|
+
? topic.title
|
|
152
|
+
: render(form.title, values);
|
|
153
|
+
return { ...form, title, values };
|
|
154
|
+
}
|
|
138
155
|
class ScheduleDispatchError extends Error {
|
|
139
156
|
reason;
|
|
140
157
|
constructor(reason) {
|
|
@@ -5,15 +5,20 @@ const keywordName = z
|
|
|
5
5
|
.string()
|
|
6
6
|
.min(1)
|
|
7
7
|
.max(200)
|
|
8
|
-
.refine((value) => value === value.trim(), "
|
|
8
|
+
.refine((value) => value === value.trim(), "Remove the spaces at the start or end of the keyword name.");
|
|
9
|
+
const values = z.record(keywordName, z.string().max(10000)).readonly();
|
|
10
|
+
// A queued topic. Each run takes the first one and removes it once its project starts.
|
|
11
|
+
// `values` is only filled on schedules saved before topics had one keyword.
|
|
9
12
|
const item = z
|
|
10
13
|
.object({
|
|
11
14
|
title: z.string().trim().min(1).max(200),
|
|
12
|
-
values
|
|
15
|
+
values,
|
|
13
16
|
})
|
|
14
17
|
.strict()
|
|
15
18
|
.readonly();
|
|
16
19
|
const policy = z.enum(["skip", "run-once"]);
|
|
20
|
+
// Enough for a year of daily runs, pasted as one list.
|
|
21
|
+
export const queueMax = 500;
|
|
17
22
|
export const scheduleCreateSchema = z
|
|
18
23
|
.object({
|
|
19
24
|
id,
|
|
@@ -21,11 +26,19 @@ export const scheduleCreateSchema = z
|
|
|
21
26
|
templateId: id,
|
|
22
27
|
templateVersion: z.number().int().positive(),
|
|
23
28
|
cadence: cadenceSchema,
|
|
24
|
-
timezone: z
|
|
29
|
+
timezone: z
|
|
30
|
+
.string()
|
|
31
|
+
.min(1)
|
|
32
|
+
.max(100)
|
|
33
|
+
.refine(validTimeZone, "Choose a time zone from the list, such as Europe/London."),
|
|
25
34
|
missedPolicy: policy.default("skip"),
|
|
26
35
|
overlapPolicy: z.literal("skip").default("skip"),
|
|
27
36
|
spendLimitCents: z.number().int().nonnegative().nullable().default(null),
|
|
28
|
-
items: z.array(item).max(
|
|
37
|
+
items: z.array(item).max(queueMax).default([]).readonly(),
|
|
38
|
+
// The template keyword each queued topic fills, such as "Topic".
|
|
39
|
+
topicKeyword: keywordName.nullable().default(null),
|
|
40
|
+
// Keywords every run uses as they are, such as the word counts.
|
|
41
|
+
values: values.default({}),
|
|
29
42
|
})
|
|
30
43
|
.strict()
|
|
31
44
|
.readonly();
|
|
@@ -54,6 +67,8 @@ export const scheduleSummarySchema = z
|
|
|
54
67
|
overlapPolicy: z.literal("skip"),
|
|
55
68
|
spendLimitCents: z.number().int().nonnegative().nullable(),
|
|
56
69
|
items: z.array(item).readonly(),
|
|
70
|
+
topicKeyword: z.string().nullable().default(null),
|
|
71
|
+
values: values.default({}),
|
|
57
72
|
status: z.enum(["active", "paused", "completed", "canceled"]),
|
|
58
73
|
version: z.number().int().positive(),
|
|
59
74
|
nextRunAt: z.string().datetime({ offset: true }).nullable(),
|
|
@@ -168,6 +168,8 @@ function summary(input, nextRunAt, now, status = "active", version = 1) {
|
|
|
168
168
|
overlapPolicy: input.overlapPolicy,
|
|
169
169
|
spendLimitCents: input.spendLimitCents,
|
|
170
170
|
items: input.items,
|
|
171
|
+
topicKeyword: input.topicKeyword,
|
|
172
|
+
values: input.values,
|
|
171
173
|
status,
|
|
172
174
|
version,
|
|
173
175
|
nextRunAt,
|
|
@@ -37,7 +37,7 @@ export async function saveCliPath(deps, id, raw) {
|
|
|
37
37
|
if (deps.hostCliStatus)
|
|
38
38
|
return {
|
|
39
39
|
ok: false,
|
|
40
|
-
message: "
|
|
40
|
+
message: "Slopify runs in Docker, so it finds these tools on your computer (the Docker host) by itself. If you installed or moved one, run the Slopify Docker launcher again.",
|
|
41
41
|
};
|
|
42
42
|
// A slow version probe must not overwrite a later Save or Reset from another tab.
|
|
43
43
|
let queue = saves.get(deps.db);
|
|
@@ -66,13 +66,16 @@ async function save(deps, id, raw) {
|
|
|
66
66
|
if (!parsed.success)
|
|
67
67
|
return {
|
|
68
68
|
ok: false,
|
|
69
|
-
message: "Enter
|
|
69
|
+
message: "Enter the full path to the program file, without quotes or extra options, or leave it blank to let Slopify find it.",
|
|
70
70
|
};
|
|
71
71
|
const configured = parsed.data === "" ? null : parsed.data;
|
|
72
72
|
if (configured !== null) {
|
|
73
73
|
try {
|
|
74
74
|
if (!(await stat(configured)).isFile())
|
|
75
|
-
return {
|
|
75
|
+
return {
|
|
76
|
+
ok: false,
|
|
77
|
+
message: "This path is a folder. Enter the path to the program file inside it.",
|
|
78
|
+
};
|
|
76
79
|
await access(configured, process.platform === "win32" ||
|
|
77
80
|
[".js", ".mjs", ".cjs"].includes(extname(configured).toLowerCase())
|
|
78
81
|
? constants.R_OK
|
|
@@ -84,7 +87,7 @@ async function save(deps, id, raw) {
|
|
|
84
87
|
["ENOENT", "ENOTDIR", "EACCES", "EPERM", "ELOOP"].includes(String(error.code)))
|
|
85
88
|
return {
|
|
86
89
|
ok: false,
|
|
87
|
-
message: "
|
|
90
|
+
message: "Slopify cannot find or run a program at this path. Check the path is correct and the file is allowed to run.",
|
|
88
91
|
};
|
|
89
92
|
throw error;
|
|
90
93
|
}
|
|
@@ -42,11 +42,11 @@ export function createModelCatalog(deps) {
|
|
|
42
42
|
allowsCustom: allowsCustomModel(provider),
|
|
43
43
|
warning: local
|
|
44
44
|
? provider === "codex-image"
|
|
45
|
-
? "
|
|
46
|
-
: "
|
|
45
|
+
? "Slopify could not check whether Codex CLI can make images. Make sure Codex CLI is installed and signed in, then refresh the list."
|
|
46
|
+
: "Slopify could not get the model list from this command-line tool. Check it is installed and signed in, then refresh the list, or type an exact model ID manually."
|
|
47
47
|
: saved === undefined
|
|
48
|
-
? "
|
|
49
|
-
: "
|
|
48
|
+
? "Slopify could not load this provider's model list, so it is showing its built-in choices. Check your internet connection and API key, then refresh the list."
|
|
49
|
+
: "Slopify could not update this provider's model list, so it is showing the last loaded list. Check your internet connection and API key, then refresh again.",
|
|
50
50
|
};
|
|
51
51
|
lifetime = retryMs;
|
|
52
52
|
}
|
|
@@ -19,11 +19,11 @@ export function saveSettings(deps, settings) {
|
|
|
19
19
|
if (!silenceGapValue.safeParse(settings.silenceGapSeconds).success) {
|
|
20
20
|
fields.push({
|
|
21
21
|
field: "silenceGapSeconds",
|
|
22
|
-
message: `
|
|
22
|
+
message: `Enter a whole number of seconds between 0 and ${String(silenceGapSecondsMax)}.`,
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
if (!appearanceValue.safeParse(settings.appearance).success) {
|
|
26
|
-
fields.push({ field: "appearance", message: "
|
|
26
|
+
fields.push({ field: "appearance", message: "Choose System, Light or Dark." });
|
|
27
27
|
}
|
|
28
28
|
if (fields.length > 0) {
|
|
29
29
|
return { ok: false, fields };
|
|
@@ -10,7 +10,7 @@ export function allocateAsset(deps, projectId, filename) {
|
|
|
10
10
|
const absolutePath = outputPath(deps.paths, projectId, path);
|
|
11
11
|
const directory = outputPath(deps.paths, projectId, `assets/${id}`);
|
|
12
12
|
if (dirname(absolutePath) !== directory)
|
|
13
|
-
throw new Error("
|
|
13
|
+
throw new Error("Slopify hit an internal error (a file name to save is not a plain file name). Try again; if it happens again, use Download diagnostics in Settings and report it.");
|
|
14
14
|
mkdirSync(outputPath(deps.paths, projectId, "assets"), { recursive: true, mode: 0o700 });
|
|
15
15
|
mkdirSync(directory, { mode: 0o700 });
|
|
16
16
|
return { id, projectId, path, absolutePath };
|
|
@@ -20,7 +20,7 @@ export function sealAsset(deps, pending) {
|
|
|
20
20
|
try {
|
|
21
21
|
const stats = fstatSync(file);
|
|
22
22
|
if (!stats.isFile())
|
|
23
|
-
throw new Error("
|
|
23
|
+
throw new Error("Slopify hit an internal error (a saved file is not a regular file). Try again; if it happens again, use Download diagnostics in Settings and report it.");
|
|
24
24
|
fchmodSync(file, 0o600);
|
|
25
25
|
fsyncSync(file);
|
|
26
26
|
return {
|
|
@@ -58,7 +58,7 @@ export function discardPreparedAssets(deps, assets) {
|
|
|
58
58
|
const filename = basename(asset.path);
|
|
59
59
|
requireBasename(filename);
|
|
60
60
|
if (asset.path !== `assets/${asset.id}/${filename}`) {
|
|
61
|
-
throw new Error("
|
|
61
|
+
throw new Error("Slopify hit an internal error (a prepared file is not in its allocated directory). Try again; if it happens again, use Download diagnostics in Settings and report it.");
|
|
62
62
|
}
|
|
63
63
|
const directory = outputPath(deps.paths, asset.projectId, `assets/${asset.id}`);
|
|
64
64
|
const registered = deps.db
|
|
@@ -68,7 +68,7 @@ export function discardPreparedAssets(deps, assets) {
|
|
|
68
68
|
if (row.id === asset.id)
|
|
69
69
|
return true;
|
|
70
70
|
if (typeof row.path !== "string")
|
|
71
|
-
throw new Error("
|
|
71
|
+
throw new Error("Slopify hit an internal error (a saved file has no path). Try again; if it happens again, use Download diagnostics in Settings and report it.");
|
|
72
72
|
const inside = relative(directory, outputPath(deps.paths, asset.projectId, row.path));
|
|
73
73
|
return (inside === "" ||
|
|
74
74
|
(inside !== ".." && !inside.startsWith(`..${sep}`) && !isAbsolute(inside)));
|
|
@@ -92,7 +92,7 @@ function requireBasename(filename) {
|
|
|
92
92
|
}) ||
|
|
93
93
|
/[. ]$/.test(filename) ||
|
|
94
94
|
/^(?:con|prn|aux|nul|conin\$|conout\$|com[1-9¹²³]|lpt[1-9¹²³])(?:\.|$)/i.test(filename))
|
|
95
|
-
throw new Error("
|
|
95
|
+
throw new Error("Slopify hit an internal error (a file name to save is not allowed on every system). Try again; if it happens again, use Download diagnostics in Settings and report it.");
|
|
96
96
|
}
|
|
97
97
|
function messageOf(error) {
|
|
98
98
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -14,7 +14,7 @@ function contained(root, path) {
|
|
|
14
14
|
const target = resolve(root, path);
|
|
15
15
|
const inside = relative(root, target);
|
|
16
16
|
if (inside === "" || inside.startsWith("..") || isAbsolute(inside)) {
|
|
17
|
-
throw new Error(
|
|
17
|
+
throw new Error(`Slopify hit an internal error (the saved file path ${path} resolves outside ${root}). Try again; if it happens again, use Download diagnostics in Settings and report it.`);
|
|
18
18
|
}
|
|
19
19
|
return target;
|
|
20
20
|
}
|
|
@@ -21,7 +21,7 @@ export function captionCues(words) {
|
|
|
21
21
|
!Number.isFinite(word.end) ||
|
|
22
22
|
word.start < previousEnd - 0.001 ||
|
|
23
23
|
word.end <= word.start) {
|
|
24
|
-
throw new Error("The
|
|
24
|
+
throw new Error("The saved caption timing is damaged. Use Re-run section on Video to time them again, then Retry stage.");
|
|
25
25
|
}
|
|
26
26
|
const first = pending[0];
|
|
27
27
|
if (first !== undefined &&
|
|
@@ -43,7 +43,7 @@ export async function prepareSubtitles(deps, context, audio, frame) {
|
|
|
43
43
|
const { projectId } = context.stage;
|
|
44
44
|
const project = projectById(deps.db, projectId);
|
|
45
45
|
if (project === undefined)
|
|
46
|
-
throw new Error("
|
|
46
|
+
throw new Error("This project no longer exists; it may have been deleted while it was running.");
|
|
47
47
|
const config = project.config.subtitles ?? defaultSubtitles;
|
|
48
48
|
if (config.mode === "off")
|
|
49
49
|
return undefined;
|
|
@@ -51,7 +51,7 @@ export async function prepareSubtitles(deps, context, audio, frame) {
|
|
|
51
51
|
setStageProgress(deps.db, context.stage.id, 0, 100);
|
|
52
52
|
context.emit({ type: "stage.progress", projectId, stage: "video", current: 0, total: 100 });
|
|
53
53
|
if (audio.length === 0)
|
|
54
|
-
throw new Error("
|
|
54
|
+
throw new Error("Captions need narration audio, but this project has none. Turn captions off in Edit project → Subtitles, or turn narration on, then Retry stage.");
|
|
55
55
|
const outputs = outputsOf(deps.db, projectId);
|
|
56
56
|
const segments = audio.map((segment) => ({
|
|
57
57
|
...segment,
|
|
@@ -68,7 +68,7 @@ export async function prepareSubtitles(deps, context, audio, frame) {
|
|
|
68
68
|
context.signal.throwIfAborted();
|
|
69
69
|
const cues = captionCues(words);
|
|
70
70
|
if (cues.length === 0)
|
|
71
|
-
throw new Error("
|
|
71
|
+
throw new Error("None of the narration could be matched to the article text, so captions can't be timed. Captions only work for English narration; if you uploaded your own audio, make sure it reads the article text, then Retry stage.");
|
|
72
72
|
writeFileSync(join(directory, "subtitles.srt"), serializeSrt(cues), { mode: 0o600 });
|
|
73
73
|
writeFileSync(join(directory, "subtitles.vtt"), serializeVtt(cues), { mode: 0o600 });
|
|
74
74
|
writeFileSync(join(directory, "subtitles.ass"), serializeAss(cues, {
|
|
@@ -118,7 +118,7 @@ async function timingKey(segments, signal) {
|
|
|
118
118
|
}
|
|
119
119
|
async function alignSegments(deps, context, segments, omissions) {
|
|
120
120
|
if (deps.alignSubtitles === undefined)
|
|
121
|
-
throw new Error("
|
|
121
|
+
throw new Error("Slopify hit an internal error (the caption timing tool is missing from this build). Retry stage; if it happens again, use Download diagnostics in Settings and report it.");
|
|
122
122
|
const words = [];
|
|
123
123
|
const total = segments.reduce((sum, segment) => sum + segment.seconds, 0);
|
|
124
124
|
let offset = 0;
|
|
@@ -146,7 +146,7 @@ async function alignSegments(deps, context, segments, omissions) {
|
|
|
146
146
|
});
|
|
147
147
|
for (const word of aligned) {
|
|
148
148
|
if (word.end > segment.seconds + 0.1)
|
|
149
|
-
throw new Error("
|
|
149
|
+
throw new Error("Caption timing came out longer than the narration audio. Retry stage; if it happens again, use Download diagnostics in Settings and report it.");
|
|
150
150
|
words.push({
|
|
151
151
|
...word,
|
|
152
152
|
start: word.start + offset,
|
|
@@ -27,7 +27,7 @@ export function spokenText(deps, projectId, kind, outputs) {
|
|
|
27
27
|
return segment.text;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
throw new Error(`The saved ${kind
|
|
30
|
+
throw new Error(`The saved text of the ${kind === "body" ? "article" : kind} is missing, and captions need the text spoken in the narration. Use Re-run section on Article, then Retry stage.`);
|
|
31
31
|
}
|
|
32
32
|
function payload(raw) {
|
|
33
33
|
return textPayload.parse(JSON.parse(raw ?? "null"));
|
|
@@ -16,19 +16,19 @@ export async function runThumbnail(deps, context, providers) {
|
|
|
16
16
|
const { projectId } = context.stage;
|
|
17
17
|
const project = projectById(deps.db, projectId);
|
|
18
18
|
if (project === undefined) {
|
|
19
|
-
throw new Error(
|
|
19
|
+
throw new Error("This project no longer exists; it may have been deleted while it was running.");
|
|
20
20
|
}
|
|
21
21
|
const source = project.config.sources.thumbnail;
|
|
22
22
|
if (source !== "from_prompt" && source !== "prompt_by_llm") {
|
|
23
23
|
// Off is `skipped` and Provide is `provided` at project creation,
|
|
24
24
|
// so the runner never starts this stage for either.
|
|
25
|
-
throw new Error(`the thumbnail stage cannot run with its source set to ${source}
|
|
25
|
+
throw new Error(`Slopify hit an internal error (the thumbnail stage cannot run with its source set to ${source}). Retry stage; if it happens again, use Download diagnostics in Settings and report it.`);
|
|
26
26
|
}
|
|
27
27
|
const choice = project.config.images;
|
|
28
28
|
if (choice === undefined) {
|
|
29
29
|
// Admission requires the image provider whenever the thumbnail is generated, so reaching
|
|
30
30
|
// here is a bug in admission rather than the user's.
|
|
31
|
-
throw new Error("the
|
|
31
|
+
throw new Error("No image model is set for the thumbnail. Choose one in Edit project → Providers, then Retry stage.");
|
|
32
32
|
}
|
|
33
33
|
const result = source === "from_prompt" ? undefined : await byLlm(deps, context, providers, project);
|
|
34
34
|
if (result !== undefined && !result.ok)
|
|
@@ -60,7 +60,7 @@ export async function runThumbnail(deps, context, providers) {
|
|
|
60
60
|
function fromTemplate(project) {
|
|
61
61
|
const rendered = project.config.rendered.thumbnailPrompt;
|
|
62
62
|
if (rendered === undefined) {
|
|
63
|
-
throw new Error("
|
|
63
|
+
throw new Error("Slopify hit an internal error (the thumbnail prompt was never filled in). Retry stage; if it happens again, use Download diagnostics in Settings and report it.");
|
|
64
64
|
}
|
|
65
65
|
return rendered;
|
|
66
66
|
}
|
|
@@ -83,7 +83,7 @@ async function byLlm(deps, context, providers, project) {
|
|
|
83
83
|
}
|
|
84
84
|
if (llm === undefined) {
|
|
85
85
|
// Admission requires the LLM row when the thumbnail source is Prompt by LLM.
|
|
86
|
-
throw new Error("the
|
|
86
|
+
throw new Error("No AI model is set for writing the thumbnail prompt. Choose one in Edit project → Providers, then Retry stage.");
|
|
87
87
|
}
|
|
88
88
|
const messages = thumbnailMessages(brief(deps, project));
|
|
89
89
|
const answer = await providers.llm({
|
|
@@ -117,7 +117,7 @@ function named(choice) {
|
|
|
117
117
|
function brief(deps, project) {
|
|
118
118
|
const instruction = project.config.rendered.thumbnailPrompt;
|
|
119
119
|
if (instruction === undefined) {
|
|
120
|
-
throw new Error("
|
|
120
|
+
throw new Error("Slopify hit an internal error (the thumbnail prompt was never filled in). Retry stage; if it happens again, use Download diagnostics in Settings and report it.");
|
|
121
121
|
}
|
|
122
122
|
return {
|
|
123
123
|
instruction,
|
|
@@ -133,7 +133,7 @@ function brief(deps, project) {
|
|
|
133
133
|
function articleText(deps, projectId) {
|
|
134
134
|
const article = outputsOf(deps.db, projectId).find((output) => output.role === "article_txt");
|
|
135
135
|
if (article === undefined) {
|
|
136
|
-
throw new Error("the
|
|
136
|
+
throw new Error("The thumbnail prompt is written from the article, but the article isn't ready. Let the Article stage finish, then Retry stage.");
|
|
137
137
|
}
|
|
138
138
|
return readFileSync(outputPath(deps.paths, projectId, article.path), "utf8");
|
|
139
139
|
}
|
|
@@ -212,7 +212,7 @@ function instructionsText(messages) {
|
|
|
212
212
|
}
|
|
213
213
|
function payloadOf(piece) {
|
|
214
214
|
if (piece.payload === null) {
|
|
215
|
-
throw new Error(
|
|
215
|
+
throw new Error("Slopify hit an internal error (the saved thumbnail prompt is empty). Retry stage; if it happens again, use Download diagnostics in Settings and report it.");
|
|
216
216
|
}
|
|
217
217
|
return writtenPayload.parse(JSON.parse(piece.payload));
|
|
218
218
|
}
|
|
@@ -5,9 +5,9 @@ export async function audioInputs(deps, projectId, outputs, signal) {
|
|
|
5
5
|
const dir = projectDir(deps.paths, projectId);
|
|
6
6
|
const body = await audio(deps, outputs, "audio_body", dir, signal);
|
|
7
7
|
if (!body)
|
|
8
|
-
throw new Error("
|
|
8
|
+
throw new Error("The video has no narration audio to play. Let the Narration stage finish, then Retry stage.");
|
|
9
9
|
if (body.seconds <= 0)
|
|
10
|
-
throw new Error("the narration audio
|
|
10
|
+
throw new Error("The narration audio contains no sound; the file may be damaged or empty. Regenerate the narration (or upload a different audio file in Edit project → Narration), then Retry stage.");
|
|
11
11
|
const intro = await audio(deps, outputs, "audio_intro", dir, signal);
|
|
12
12
|
const outro = await audio(deps, outputs, "audio_outro", dir, signal);
|
|
13
13
|
return { body, intro, outro };
|