Skip to content

Open source CapCut alternative.

TypeScript

test(site): chat eval case for a built-in LUT by name

David Le1924850ab229
diff --git a/site/scripts/lib/cut-eval/cases.ts b/site/scripts/lib/cut-eval/cases.ts
index 28e9883b..f1d20fa9 100644
--- a/site/scripts/lib/cut-eval/cases.ts
+++ b/site/scripts/lib/cut-eval/cases.ts
@@ -11,6 +11,7 @@
*/
import { gradePresetsInCategory } from "@donkeycut/effects-kit";
+import { BUILTIN_LUTS } from "../../../src/cut/lib/builtinLuts";
import {
AUDIO_STATE,
CLIP_REFS,
@@ -334,6 +335,29 @@ export function cases(audio: { dataBase64: string; mimeType: string }): EvalCase
return undefined;
},
},
+ {
+ // A built-in LUT asked for by name: the chat reads its id off
+ // editor_state.luts and lands it on both clips in one sweep.
+ name: "builtin-lut-by-name",
+ instant: null,
+ bucket: "single-tool",
+ state: LUT_STATE,
+ input: () => [userTurn("put the Warm Fade LUT on both clips")],
+ reply: /Warm Fade|LUT|look|both|clips/i,
+ requiredTools: ["set_color_lut"],
+ maxToolCalls: 3,
+ simulate: () => (name, args) => {
+ if (name === "set_color_lut") {
+ const want = `lut:${BUILTIN_LUTS.find((l) => l.id === "warm-fade")!.key}`;
+ if (args.lut !== want)
+ throw new Error(`set_color_lut must name the built-in Warm Fade (${want}), got ${JSON.stringify(args.lut)}`);
+ if (args.all_clips !== true && !Array.isArray(args.ids))
+ throw new Error("set_color_lut must land on both clips (all_clips or ids), not one at a time");
+ return { ran: 2, ids: ["c1", "c2"], results: [] };
+ }
+ return undefined;
+ },
+ },
{
// Footage the header did not settle, named by the user: the source
// colour switch, not a grade that fights the log curve by hand.
diff --git a/site/scripts/lib/cut-eval/fixtures.ts b/site/scripts/lib/cut-eval/fixtures.ts
index 2b2fbf84..0e03db3a 100644
--- a/site/scripts/lib/cut-eval/fixtures.ts
+++ b/site/scripts/lib/cut-eval/fixtures.ts
@@ -10,6 +10,7 @@ import { mkdtempSync, readFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { AI_SKILL_INDEX } from "../../../src/cut/server/ai/catalog";
+import { BUILTIN_LUTS } from "../../../src/cut/lib/builtinLuts";
export type Item = Record<string, unknown>;
@@ -184,12 +185,16 @@ export const TWO_CLIP_STATE = {
],
};
-/** The pair with a Library LUT on the first clip and the shelf's LUT list,
- * for the copy-to-all case; the source is listed as plain Rec.709 with no
- * header reading, for the source-colour case. */
+/** The pair with a Library LUT on the first clip and the LUT list as the
+ * editor builds it — the built-in set, then the shelf's file — for the LUT
+ * cases; the source is listed as plain Rec.709 with no header reading, for
+ * the source-colour case. */
export const LUT_STATE = {
...TWO_CLIP_STATE,
- luts: [{ id: "lut:kodak2383", label: "Kodak 2383" }],
+ luts: [
+ ...BUILTIN_LUTS.map((l) => ({ id: `lut:${l.key}`, label: l.label, builtIn: true })),
+ { id: "lut:kodak2383", label: "Kodak 2383" },
+ ],
savedGrades: [],
videoTrack: [
{ ...TWO_CLIP_STATE.videoTrack[0], lut: { id: "lut:kodak2383", amount: 1 } },