Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Faceless: a change also redoes failed steps; new topic suggestions each round offline

Claude6ecee2dcf597
diff --git a/src/lib/catalog/faceless.ts b/src/lib/catalog/faceless.ts
index 1db72ba1..51a7d59c 100644
--- a/src/lib/catalog/faceless.ts
+++ b/src/lib/catalog/faceless.ts
@@ -1249,15 +1249,15 @@ const OFFLINE_TOPICS: Record<FacelessGenre, [string, string][]> = {
const fill = (t: string, s: string) => t.replaceAll("{S}", capital(s)).replaceAll("{s}", s);
-/** Topic suggestions without an LLM: templates per genre around the channel's subject. */
-export function offlineTopics(idea: string, genre: FacelessGenre, count = 5, skip = 0): TopicIdea[] {
+/** Topic suggestions without an LLM: templates per genre around the channel's subject; each round starts one further. */
+export function offlineTopics(idea: string, genre: FacelessGenre, count = 5, round = 0): TopicIdea[] {
const s = subjectOf(idea);
// "The rise and fall of {s}" for a channel about the rise and fall of empires would say it twice.
const lead = (t: string) => t.split("{")[0].replace(/^the\s+/i, "").trim().toLowerCase();
const all = OFFLINE_TOPICS[genre] ?? OFFLINE_TOPICS.education;
const list = all.filter(([t]) => !lead(t) || !s.toLowerCase().includes(lead(t)));
return Array.from({ length: Math.min(count, list.length) }, (_, i) => {
- const [title, hook] = list[(i + skip) % list.length];
+ const [title, hook] = list[(i + round) % list.length];
return { title: fill(title, s), hook };
});
}
diff --git a/src/server/faceless.ts b/src/server/faceless.ts
index 3b3f292d..b86296e3 100644
--- a/src/server/faceless.ts
+++ b/src/server/faceless.ts
@@ -341,7 +341,7 @@ export async function suggestTopics(input: { idea: string; genre: FacelessGenre;
const answer = await askLlm(input.engine, topicsSystem, topicsBrief({ idea: input.idea, genre, count, avoid: input.avoid, reference: input.reference }));
const topics = answer ? parseTopics(answer).slice(0, count) : [];
if (topics.length >= 3) return { topics, offline: false };
- return { topics: offlineTopics(input.idea, genre.id, count, (input.round ?? 0) * count), offline: true };
+ return { topics: offlineTopics(input.idea, genre.id, count, input.round ?? 0), offline: true };
}
// ---------------------------------------------------------------------------
@@ -733,7 +733,10 @@ function changed(ep: FacelessEpisode, c: ChangeInput) {
}
}
const graph = buildGraph(ep, blocks, stillEdits);
- return { graph, blocks, stillEdits, plan: planRerun(graph, changedKeys(graph, ids, c.part)), ids };
+ // Steps that failed earlier are redone with the change, so the new version can finish.
+ const status = statusMap(ep.plan.ids);
+ const broken = graph.filter((s) => !status[s.key] || status[s.key] === "failed" || status[s.key] === "canceled").map((s) => s.key);
+ return { graph, blocks, stillEdits, plan: planRerun(graph, [...changedKeys(graph, ids, c.part), ...broken]), ids };
}
export function previewChange(id: string, c: ChangeInput): ChangePreview {