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.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Chat: portraits for the eight built-in characters
Adarsh18029bf38904
diff --git a/public/previews/chat/dorian-hale.jpg b/public/previews/chat/dorian-hale.jpgnew file mode 100644index 00000000..9ed798d7Binary files /dev/null and b/public/previews/chat/dorian-hale.jpg differdiff --git a/public/previews/chat/ines-ruiz.jpg b/public/previews/chat/ines-ruiz.jpgnew file mode 100644index 00000000..f51809d9Binary files /dev/null and b/public/previews/chat/ines-ruiz.jpg differdiff --git a/public/previews/chat/kai.jpg b/public/previews/chat/kai.jpgnew file mode 100644index 00000000..fe922698Binary files /dev/null and b/public/previews/chat/kai.jpg differdiff --git a/public/previews/chat/luca-moretti.jpg b/public/previews/chat/luca-moretti.jpgnew file mode 100644index 00000000..62bcfe9fBinary files /dev/null and b/public/previews/chat/luca-moretti.jpg differdiff --git a/public/previews/chat/marlowe-quinn.jpg b/public/previews/chat/marlowe-quinn.jpgnew file mode 100644index 00000000..1f4a4348Binary files /dev/null and b/public/previews/chat/marlowe-quinn.jpg differdiff --git a/public/previews/chat/odette-lune.jpg b/public/previews/chat/odette-lune.jpgnew file mode 100644index 00000000..582c9087Binary files /dev/null and b/public/previews/chat/odette-lune.jpg differdiff --git a/public/previews/chat/sienna-vale.jpg b/public/previews/chat/sienna-vale.jpgnew file mode 100644index 00000000..6a89baefBinary files /dev/null and b/public/previews/chat/sienna-vale.jpg differdiff --git a/public/previews/chat/valentina-noir.jpg b/public/previews/chat/valentina-noir.jpgnew file mode 100644index 00000000..5605decfBinary files /dev/null and b/public/previews/chat/valentina-noir.jpg differdiff --git a/src/lib/chat/catalog.ts b/src/lib/chat/catalog.tsindex a58eee94..3069efa9 100644--- a/src/lib/chat/catalog.ts+++ b/src/lib/chat/catalog.ts@@ -248,7 +248,7 @@ export const BUILT_IN_CHARACTERS: CharacterCard[] = [greeting: "*glances up from the contact sheets* Ten minutes. Show me what you brought, and please tell me none of it is beige.",mature: false,accent: ["#2b2140", "#b58b5a"],- portrait: null,+ portrait: "/previews/chat/sienna-vale.jpg?v=72e7fb57",builtIn: true,},{@@ -261,7 +261,7 @@ export const BUILT_IN_CHARACTERS: CharacterCard[] = [greeting: "Welcome aboard, Commander. *hands you a datapad* Read fast. That signal is repeating my name, and we jump in four minutes.",mature: false,accent: ["#0d1b2a", "#3a86ff"],- portrait: null,+ portrait: "/previews/chat/ines-ruiz.jpg?v=3566177d",builtIn: true,},{@@ -274,7 +274,7 @@ export const BUILT_IN_CHARACTERS: CharacterCard[] = [greeting: "*rain taps the window* Door's open, kid. You look like trouble with a story attached. Sit down and tell me who's missing.",mature: false,accent: ["#1c1c1c", "#8a7650"],- portrait: null,+ portrait: "/previews/chat/marlowe-quinn.jpg?v=26979a2a",builtIn: true,},{@@ -287,7 +287,7 @@ export const BUILT_IN_CHARACTERS: CharacterCard[] = [greeting: "Hey, you made it before close. *slides a mug over* On the house. Long day, or a good one?",mature: false,accent: ["#3b2a20", "#e0a458"],- portrait: null,+ portrait: "/previews/chat/kai.jpg?v=4d771a8e",builtIn: true,},{@@ -300,7 +300,7 @@ export const BUILT_IN_CHARACTERS: CharacterCard[] = [greeting: "*a small thundercloud rumbles on the desk* Ah, the culprit! Sit, sit. Honestly? Best transfiguration I've seen in years. Now, how do we turn him back?",mature: false,accent: ["#20123a", "#9d7bd8"],- portrait: null,+ portrait: "/previews/chat/odette-lune.jpg?v=e327f538",builtIn: true,},{@@ -313,7 +313,7 @@ export const BUILT_IN_CHARACTERS: CharacterCard[] = [greeting: "*the lift shudders and stops* Of course. Of all the designers in Paris, I get stuck with you. *raises the bottle* Truce until the doors open?",mature: false,accent: ["#2a0f1e", "#d4567c"],- portrait: null,+ portrait: "/previews/chat/dorian-hale.jpg?v=f1a917a9",builtIn: true,},{@@ -326,7 +326,7 @@ export const BUILT_IN_CHARACTERS: CharacterCard[] = [greeting: "*steps out onto the balcony, mask in hand* You've been watching me all night. Bold. Tell me your name before I decide whether to keep you.",mature: true,accent: ["#1a0508", "#a4161a"],- portrait: null,+ portrait: "/previews/chat/valentina-noir.jpg?v=d9a26f0d",builtIn: true,},{@@ -339,7 +339,7 @@ export const BUILT_IN_CHARACTERS: CharacterCard[] = [greeting: "*hands you a glass, leans on the rail beside you* Everyone else went below. Good. The sunset was getting jealous of you anyway.",mature: true,accent: ["#0b3954", "#ff8552"],- portrait: null,+ portrait: "/previews/chat/luca-moretti.jpg?v=845f17af",builtIn: true,},];diff --git a/src/server/chat/files.ts b/src/server/chat/files.tsindex fe1209cc..d5f16ea1 100644--- a/src/server/chat/files.ts+++ b/src/server/chat/files.ts@@ -1,4 +1,6 @@import "server-only";+import fs from "node:fs";+import path from "node:path";import { localHead, readRef, saveFile } from "../storage";import { runAsTenant } from "../tenant";@@ -35,8 +37,19 @@ export async function readPicture(who: string, ref: string): Promise<{ data: Buf}}+/** A built-in character's portrait: a public file the site ships (src/lib/chat/catalog.ts). */+const BUILT_IN_PORTRAIT = /^\/previews\/chat\/([a-z0-9-]{1,60})\.jpg(?:\?v=[0-9a-f]{8})?$/;+/** A picture read for anyone (a shared chat's portrait): no account check. Only for refs a share row holds. */export async function readSharedPicture(ref: string): Promise<{ data: Buffer; contentType: string } | null> {+ const builtIn = BUILT_IN_PORTRAIT.exec(ref);+ if (builtIn) {+ try {+ return { data: await fs.promises.readFile(path.join(process.cwd(), "public", "previews", "chat", `${builtIn[1]}.jpg`)), contentType: "image/jpeg" };+ } catch {+ return null;+ }+ }if (!FILE_REF.test(ref) || ref.includes("..")) return null;try {const f = await readRef(ref);diff --git a/tests/preset-covers.test.ts b/tests/preset-covers.test.tsindex b252e2c7..67107a50 100644--- a/tests/preset-covers.test.ts+++ b/tests/preset-covers.test.ts@@ -19,6 +19,7 @@ import { presetHdFiles } from "@/lib/preset-hd";import { PRESET_PEAKS } from "@/lib/preset-peaks.generated";import { PRESET_PREVIEWS } from "@/lib/preset-previews.generated";import { STUDIO_COVERS } from "@/lib/studio-covers";+import { BUILT_IN_CHARACTERS } from "@/lib/chat/catalog";import { mp4Seconds } from "./helpers/mp4-length";/*@@ -112,6 +113,8 @@ describe("the preset covers manifest", () => {for (const id of Object.keys(PRESET_HD)) for (const f of presetHdFiles(id, !!PRESET_PEAKS[id])) named.add(f);// Home's first screen makes its own clips and stills (scripts/gen-home-bento.mjs, tests/home-bento.test.ts).for (const f of Object.keys(HOME_BENTO_MEDIA)) named.add(f);+ // Chat's built-in characters' portraits (src/lib/chat/catalog.ts).+ for (const c of BUILT_IN_CHARACTERS) if (c.portrait) named.add(c.portrait.split("?")[0]);const dir = path.join(root, "public", "previews");const files = fs.existsSync(dir) ? fs.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((f) => /\.(jpg|mp4)$/.test(f)) : [];// public/previews/templates is the template covers' (tests/template-covers.test.ts checks it).