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.

Chat: the workspace sidebar on every Chat page, and a Workshop of creative, artistic and productive formats

Adarshbfdff0985c1c
diff --git a/src/app/(studio)/chat/(make)/layout.tsx b/src/app/(studio)/chat/(make)/layout.tsx
deleted file mode 100644
index 72ef7b71..00000000
--- a/src/app/(studio)/chat/(make)/layout.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-import { AssistShell } from "@/components/assist/shell";
-
-/** The making side of Chat: its sidebar (making chats, projects, skills, memory) beside each of its pages. */
-export default function AssistLayout({ children }: LayoutProps<"/chat">) {
- return <AssistShell>{children}</AssistShell>;
-}
diff --git a/src/app/(studio)/chat/layout.tsx b/src/app/(studio)/chat/layout.tsx
new file mode 100644
index 00000000..7a52bd96
--- /dev/null
+++ b/src/app/(studio)/chat/layout.tsx
@@ -0,0 +1,6 @@
+import { AssistShell } from "@/components/assist/shell";
+
+/** Chat's workspace: its sidebar (chats, projects, skills, memory, scheduled tasks) beside every Chat page. */
+export default function ChatLayout({ children }: LayoutProps<"/chat">) {
+ return <AssistShell>{children}</AssistShell>;
+}
diff --git a/src/components/assist/shell.tsx b/src/components/assist/shell.tsx
index 6e3a12d1..f069af3d 100644
--- a/src/components/assist/shell.tsx
+++ b/src/components/assist/shell.tsx
@@ -9,7 +9,9 @@ import { Input } from "@/components/ui/input";
import { Sheet, SheetContent, SheetDescription, SheetTitle } from "@/components/ui/sheet";
import { Skeleton } from "@/components/ui/skeleton";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
-import { useIsOwner } from "@/lib/api";
+import { useHydrated, useIsGuest, useIsOwner } from "@/lib/api";
+import { CharacterFace } from "@/components/chat/character-face";
+import { useChatThreads } from "@/components/chat/hooks";
import { timeAgo } from "@/lib/format";
import { cn } from "@/lib/utils";
import { ChatMenu } from "./chat-menu";
@@ -18,14 +20,14 @@ import { ProjectDialog } from "./project-dialog";
import { ProjectDot } from "./project-dot";
/**
- * Assist's own sidebar (Supercomputer's): New chat, Search, Skills, Memory, Scheduled, Projects and Chats.
+ * Chat's workspace sidebar: New chat, Search, Skills, Memory, Scheduled, Projects and every chat (talking and making).
* A column from xl up; below that the same list opens as a sheet from the header button.
*/
export function AssistShell({ children }: { children: React.ReactNode }) {
return (
<div className="flex min-w-0 flex-1">
- <aside className="sticky top-chrome hidden h-content w-64 shrink-0 flex-col border-r bg-sidebar/40 xl:flex" aria-label="Make">
+ <aside className="sticky top-chrome hidden h-content w-64 shrink-0 flex-col border-r bg-sidebar/40 xl:flex" aria-label="Chat">
<Suspense fallback={<RailSkeleton />}>
<Rail />
</Suspense>
@@ -50,7 +52,7 @@ export function RailButton({ className }: { className?: string }) {
</Tooltip>
<Sheet open={open} onOpenChange={setOpen}>
<SheetContent side="left" className="w-[min(86vw,320px)] gap-0 p-0" aria-describedby={undefined} onOpenAutoFocus={(e) => e.preventDefault()}>
- <SheetTitle className="sr-only">Make</SheetTitle>
+ <SheetTitle className="sr-only">Chat</SheetTitle>
<SheetDescription className="sr-only">Chats, projects, skills, memory and scheduled tasks</SheetDescription>
<Suspense fallback={<RailSkeleton />}>
<Rail onNavigate={() => setOpen(false)} />
@@ -100,12 +102,21 @@ function Rail({ onNavigate }: { onNavigate?: () => void }) {
const [creating, setCreating] = useState(false);
// A guest or an account (public sign-up): Assist's projects are the owner's.
const owner = useIsOwner();
+ // Talking chats (Chat's own) beside the making chats, newest first. A guest has none (and isn't asked).
+ const hydrated = useHydrated();
+ const guest = useIsGuest();
+ const talks = useChatThreads(hydrated && !guest, q);
+ const rows = [
+ ...(talks.data?.items ?? []).map((t) => ({ kind: "talk" as const, id: t.id, title: t.title, updatedAt: t.updatedAt, href: `/chat/${t.id}`, talk: t })),
+ ...(chats.data?.threads ?? []).map((t) => ({ kind: "make" as const, id: t.id, title: t.title, updatedAt: t.updatedAt, href: `/chat/make?c=${t.id}`, make: t })),
+ ].sort((a, b) => b.updatedAt - a.updatedAt);
+ const loading = chats.isLoading || (hydrated && !guest && talks.isLoading);
return (
<div className="flex min-h-0 flex-1 flex-col">
<div className={cn("space-y-2 p-3 pb-2", onNavigate && "pt-12")}>
<Button asChild variant="outline" className="h-9 w-full justify-start rounded-full">
- <Link href="/chat/make" onClick={onNavigate}>
+ <Link href="/chat" onClick={onNavigate}>
<MessageSquarePlus /> New chat
</Link>
</Button>
@@ -118,7 +129,7 @@ function Rail({ onNavigate }: { onNavigate?: () => void }) {
</button>
)}
</div>
- <nav className="space-y-0.5" aria-label="Make pages">
+ <nav className="space-y-0.5" aria-label="Chat pages">
<RailLink href="/chat/skills" icon={Sparkles} label="Skills" active={pathname.startsWith("/chat/skills")} onNavigate={onNavigate} />
<RailLink href="/chat/memory" icon={Brain} label="Memory" active={pathname.startsWith("/chat/memory")} onNavigate={onNavigate} />
<RailLink href="/chat/scheduled" icon={CalendarClock} label="Scheduled" active={pathname.startsWith("/chat/scheduled")} onNavigate={onNavigate} />
@@ -177,15 +188,33 @@ function Rail({ onNavigate }: { onNavigate?: () => void }) {
<h2 id="rail-chats" className="px-2.5 pt-2 pb-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase">
{q ? `Results for “${q}”` : "Chats"}
</h2>
- {chats.isLoading ? (
+ {loading ? (
<div className="space-y-1.5 px-2.5">
{Array.from({ length: 4 }, (_, i) => (
<Skeleton key={i} className="h-6" />
))}
</div>
- ) : chats.data?.threads.length ? (
+ ) : rows.length ? (
<ul className="space-y-0.5">
- {chats.data.threads.map((t) => {
+ {rows.map((row) => {
+ if (row.kind === "talk") {
+ const t = row.talk;
+ const active = pathname === row.href;
+ return (
+ <li key={`talk-${t.id}`}>
+ <Link
+ href={row.href}
+ onClick={onNavigate}
+ aria-current={active ? "page" : undefined}
+ className={cn("flex min-h-8 items-center gap-2 rounded-lg py-1.5 pr-2 pl-2.5 transition-colors hover:bg-accent", active && "bg-accent")}
+ >
+ {t.character && <CharacterFace name={t.character.name} accent={t.character.accent} portrait={t.character.portrait} className="size-5" />}
+ <span className="min-w-0 flex-1 truncate text-[13px]">{t.title}</span>
+ </Link>
+ </li>
+ );
+ }
+ const t = row.make;
const project = t.projectId ? projects.data?.find((p) => p.id === t.projectId) : undefined;
return (
<li key={t.id} className="group/chat relative">
diff --git a/src/components/chat/chat-home.tsx b/src/components/chat/chat-home.tsx
index a69fac65..eae86c91 100644
--- a/src/components/chat/chat-home.tsx
+++ b/src/components/chat/chat-home.tsx
@@ -1,7 +1,7 @@
"use client";
import { useQueryClient } from "@tanstack/react-query";
-import { Pencil, Plus, Settings2, Sparkles } from "lucide-react";
+import { Pencil, Plus, Settings2 } from "lucide-react";
import Link from "next/link";
import { useRouter, useSearchParams } from "next/navigation";
import { useEffect, useMemo, useRef, useState } from "react";
@@ -11,20 +11,19 @@ import { Button } from "@/components/ui/button";
import { Skeleton } from "@/components/ui/skeleton";
import { TAB_PILL, TabRow, onAttr } from "@/components/ui/tab-row";
import { askToSignUp, useHydrated, useIsGuest, useViewer } from "@/lib/api";
-import { BUILT_IN_CHARACTERS, CHAT_KINDS, isChatKind, MANGO_CHILLI, PLAY_FORMATS, STARTERS, WRITE_TOOLS, playFormat, writeTool, type CharacterCard, type ChatKind, type PlayFormat, type WriteTool } from "@/lib/chat/catalog";
+import { BUILT_IN_CHARACTERS, CHAT_KINDS, isChatKind, MANGO_CHILLI, STARTERS, WRITE_TOOLS, workshopFormat, writeTool, type CharacterCard, type ChatKind, type PlayFormat, type WriteTool } from "@/lib/chat/catalog";
import { playMessage, toolMessage } from "@/lib/chat/prompt";
-import type { ChatThreadSummary } from "@/lib/chat/types";
import { toastError } from "@/lib/refusals";
import { cn } from "@/lib/utils";
-import { useChats } from "@/components/assist/hooks";
-import type { AssistThreadSummary } from "@/lib/assist";
+import { RailButton } from "@/components/assist/shell";
import { CharacterBuilder } from "./character-builder";
import { CharacterFace } from "./character-face";
import { ChatComposer } from "./composer";
import { ChatSettingsDialog, ChilliDot, CHILLI_BG, MangoChilliDialog, PlayDialog, WriteToolDialog } from "./dialogs";
-import { chatSend, useCharacters, useChatMe, useChatThreads, useStartChat } from "./hooks";
-import { EngineLine, KindIcon, timeAgo } from "./bits";
-import { MakeBox, MoreMenu } from "./make";
+import { chatSend, useCharacters, useChatMe, useStartChat } from "./hooks";
+import { EngineLine } from "./bits";
+import { MakeBox } from "./make";
+import { WorkshopGrid } from "./workshop";
/**
* Fuobe Chat's home: one box to start talking, the kinds of chat (Chat, Ideas, Write, Characters, Play), the
@@ -42,20 +41,17 @@ export function ChatHome() {
const known = hydrated && viewer.isSuccess;
const signedIn = known && !guest;
const me = useChatMe(signedIn);
- const threads = useChatThreads(signedIn);
const characters = useCharacters(signedIn);
- // The owner's Assist chats sit in Recent too, until they open in Chat itself (an account's list comes back empty).
- const assistChats = useChats();
const start = useStartChat();
// A link can open a kind, a writing tool or a game with its form (?kind=, ?tool=, ?play=).
const [kind, setKind] = useState<ChatKind>(() => {
const k = sp.get("kind");
- return playFormat(sp.get("play")) ? "play" : writeTool(sp.get("tool")) ? "write" : isChatKind(k) ? k : "chat";
+ return workshopFormat(sp.get("play")) ? "play" : writeTool(sp.get("tool")) ? "write" : isChatKind(k) ? k : "chat";
});
const [tool, setTool] = useState<WriteTool | null>(() => writeTool(sp.get("tool")));
const [play, setPlay] = useState<PlayFormat | null>(() => {
- const p = playFormat(sp.get("play"));
+ const p = workshopFormat(sp.get("play"));
return p && (p.ask || p.picture) ? p : null;
});
const [building, setBuilding] = useState<{ open: boolean; editing: CharacterCard | null }>({ open: false, editing: null });
@@ -92,7 +88,7 @@ export function ChatHome() {
if (handled.current || !known) return;
const character = sp.get("character");
const from = sp.get("from");
- const p = playFormat(sp.get("play"));
+ const p = workshopFormat(sp.get("play"));
const now = p && !p.ask && !p.picture ? p : null;
if (!character && !from && !now) return;
handled.current = true;
@@ -122,6 +118,7 @@ export function ChatHome() {
return (
<div className="flex h-content min-w-0 flex-col">
<header className="flex h-14 shrink-0 items-center gap-1.5 px-4 sm:px-6">
+ <RailButton />
<Link href="/chat" className="font-heading text-[22px] leading-none">
Chat
</Link>
@@ -146,7 +143,6 @@ export function ChatHome() {
</Button>
</>
)}
- <MoreMenu />
<PhoneNavButton />
</header>
@@ -236,28 +232,13 @@ export function ChatHome() {
))}
</div>
) : kind === "play" ? (
- <div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
- {PLAY_FORMATS.map((p) => (
- <button
- key={p.id}
- type="button"
- onClick={() => {
- if (!gate()) return;
- if (p.ask || p.picture) setPlay(p);
- else void go({ kind: "play", play: p.id, text: playMessage(p.id, "") });
- }}
- className="flex items-start gap-3 rounded-2xl border bg-background p-4 text-left transition-[border-color,box-shadow] hover:border-primary hover:shadow-soft focus-visible:ring-4 focus-visible:ring-brand-faint focus-visible:outline-none"
- >
- <span className="text-[26px] leading-none" aria-hidden>
- {p.emoji}
- </span>
- <span className="min-w-0">
- <span className="block text-[15px] font-medium">{p.name}</span>
- <span className="mt-0.5 block text-[13.5px] text-muted-foreground">{p.blurb}</span>
- </span>
- </button>
- ))}
- </div>
+ <WorkshopGrid
+ onPick={(p) => {
+ if (!gate()) return;
+ if (p.ask || p.picture) setPlay(p);
+ else void go({ kind: "play", play: p.id, text: playMessage(p.id, "") });
+ }}
+ />
) : null}
</section>
@@ -281,7 +262,6 @@ export function ChatHome() {
</section>
)}
- {signedIn && <Recent threads={threads.data?.items} assist={me.data?.owner ? assistChats.data?.threads : undefined} loading={threads.isPending} />}
</div>
</div>
@@ -369,67 +349,3 @@ function CharacterShelf({
);
}
-type RecentRow = ChatThreadSummary & { href: string; making?: boolean };
-
-function Recent({ threads, assist, loading }: { threads: ChatThreadSummary[] | undefined; assist?: AssistThreadSummary[]; loading: boolean }) {
- const [all, setAll] = useState(false);
- // Chats and (the owner's) making chats in one list, newest first.
- const rows: RecentRow[] = [
- ...(threads ?? []).map((t) => ({ ...t, href: `/chat/${t.id}` })),
- ...(assist ?? []).map((a) => ({
- id: a.id,
- kind: "ideas" as const,
- title: a.title,
- characterId: null,
- character: null,
- tool: null,
- play: null,
- mature: false,
- preview: "Plans and makes",
- updatedAt: a.updatedAt,
- href: `/chat/make?c=${a.id}`,
- making: true,
- })),
- ].sort((x, y) => y.updatedAt - x.updatedAt);
- if (!loading && !rows.length) return null;
- const more = rows.length - 12;
- return (
- <section className="mt-12">
- <h2 className="mb-2 font-heading text-[28px] leading-none">Recent</h2>
- <ul className="divide-y">
- {loading
- ? Array.from({ length: 3 }, (_, i) => (
- <li key={i} className="py-3">
- <Skeleton className="h-10 w-full" />
- </li>
- ))
- : rows.slice(0, all ? undefined : 12).map((t) => (
- <li key={t.id}>
- <Link href={t.href} className="group flex items-center gap-3 py-3">
- {t.character ? (
- <CharacterFace name={t.character.name} accent={t.character.accent} portrait={t.character.portrait} className="size-10" />
- ) : (
- <span className="grid size-10 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground">
- {t.making ? <Sparkles className="size-[18px]" /> : <KindIcon kind={t.kind} />}
- </span>
- )}
- <span className="min-w-0 flex-1">
- <span className="flex items-center gap-1.5">
- <span className="truncate text-[15px] font-medium group-hover:text-brand-text">{t.title}</span>
- {t.mature && <ChilliDot className="size-2" />}
- </span>
- <span className="block truncate text-[13px] text-muted-foreground">{t.preview || " "}</span>
- </span>
- <span className="shrink-0 text-[12px] text-subtle-foreground">{timeAgo(t.updatedAt)}</span>
- </Link>
- </li>
- ))}
- </ul>
- {!loading && !all && more > 0 && (
- <Button variant="ghost" size="sm" className="mt-2 text-muted-foreground" onClick={() => setAll(true)}>
- Show {more} more
- </Button>
- )}
- </section>
- );
-}
diff --git a/src/components/chat/dialogs.tsx b/src/components/chat/dialogs.tsx
index 6678aa52..4a4decda 100644
--- a/src/components/chat/dialogs.tsx
+++ b/src/components/chat/dialogs.tsx
@@ -18,6 +18,7 @@ import { cn } from "@/lib/utils";
import { CharacterFace } from "./character-face";
import { chatSend } from "./hooks";
import { ReplyBody } from "./prose";
+import { WorkshopCover } from "./workshop";
/** Mango Chilli's mark: its two colours, used only for this mode. */
export const CHILLI_BG = "bg-[linear-gradient(135deg,#ffb020_0%,#ff6a2b_55%,#e8352b_100%)]";
@@ -377,8 +378,8 @@ export function PlayDialog({ play, onOpenChange, onStart }: { play: PlayFormat |
}}
>
<DialogHeader>
- <DialogTitle className="flex items-center gap-2">
- <span aria-hidden>{play.emoji}</span>
+ <DialogTitle className="flex items-center gap-2.5">
+ <WorkshopCover format={play} className="size-9 shrink-0 rounded-lg" />
{play.name}
</DialogTitle>
<DialogDescription>{play.blurb}</DialogDescription>
@@ -400,7 +401,7 @@ export function PlayDialog({ play, onOpenChange, onStart }: { play: PlayFormat |
) : (
<span className="flex flex-col items-center gap-2 text-[14px]">
<ImagePlus className="size-6" />
- Add a full-length photo of your outfit
+ {play.id === "style-critique" ? "Add a full-length photo of the outfit" : "Add the photo you want notes on"}
</span>
)}
</button>
diff --git a/src/components/chat/make.tsx b/src/components/chat/make.tsx
index 31214b20..4b1f79ff 100644
--- a/src/components/chat/make.tsx
+++ b/src/components/chat/make.tsx
@@ -1,12 +1,9 @@
"use client";
-import { BookOpen, Brain, CalendarClock, Clapperboard, ImageIcon, Music4, Plus } from "lucide-react";
-import Link from "next/link";
+import { Clapperboard, ImageIcon, Music4 } from "lucide-react";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { toast } from "sonner";
-import { Button } from "@/components/ui/button";
-import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { askToSignUp, useAssistActions, useEngine } from "@/lib/api";
import { ASSIST_SUGGESTIONS } from "@/lib/assist";
import { makeItHref, type MakeStudio } from "@/lib/chat/prompt";
@@ -103,33 +100,3 @@ export function MakeBox({ owner, guest }: { owner: boolean; guest: boolean }) {
</div>
);
}
-
-/** The "+" menu: the tools that keep working across chats (skills, memory, scheduled tasks). */
-export function MoreMenu() {
- return (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="ghost" size="icon" aria-label="More in Chat">
- <Plus />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-60">
- <DropdownMenuItem asChild>
- <Link href="/chat/skills">
- <BookOpen /> Skills
- </Link>
- </DropdownMenuItem>
- <DropdownMenuItem asChild>
- <Link href="/chat/memory">
- <Brain /> Memory
- </Link>
- </DropdownMenuItem>
- <DropdownMenuItem asChild>
- <Link href="/chat/scheduled">
- <CalendarClock /> Scheduled tasks
- </Link>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- );
-}
diff --git a/src/components/chat/thread-view.tsx b/src/components/chat/thread-view.tsx
index 76e2c2cb..271ab68e 100644
--- a/src/components/chat/thread-view.tsx
+++ b/src/components/chat/thread-view.tsx
@@ -5,6 +5,7 @@ import { ArrowLeft, Check, Copy, MoreHorizontal, Pencil, RotateCcw, Share2, Tras
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
+import { RailButton } from "@/components/assist/shell";
import { PhoneNavButton } from "@/components/nav/phone-nav-button";
import {
AlertDialog,
@@ -108,7 +109,7 @@ export function ThreadView({ id }: { id: string }) {
}
const c = t?.characterCard ?? null;
- const label = !t ? "" : c ? c.tagline : t.kind === "play" ? (playFormat(t.play)?.name ?? "Play") : t.kind === "write" ? (writeTool(t.tool)?.name ?? "Write") : CHAT_KINDS.find((k) => k.id === t.kind)?.label;
+ const label = !t ? "" : c ? c.tagline : t.kind === "play" ? (playFormat(t.play)?.name ?? "Workshop") : t.kind === "write" ? (writeTool(t.tool)?.name ?? "Write") : CHAT_KINDS.find((k) => k.id === t.kind)?.label;
const lastAssistant = t?.messages.findLast((m) => m.role === "assistant");
const lastUser = t?.messages.findLast((m) => m.role === "user");
const canRetry = !!t && !busy && t.messages.at(-1)?.role === "assistant" && t.messages.length > 1;
@@ -116,7 +117,8 @@ export function ThreadView({ id }: { id: string }) {
return (
<Frame>
<header className="flex h-14 shrink-0 items-center gap-2 border-b px-3 sm:px-5">
- <Button variant="ghost" size="icon" asChild aria-label="All chats">
+ <RailButton />
+ <Button variant="ghost" size="icon" asChild aria-label="Chat home" className="xl:hidden">
<Link href="/chat">
<ArrowLeft />
</Link>
diff --git a/src/components/chat/workshop.tsx b/src/components/chat/workshop.tsx
new file mode 100644
index 00000000..7d5710ee
--- /dev/null
+++ b/src/components/chat/workshop.tsx
@@ -0,0 +1,67 @@
+"use client";
+
+import { Aperture, CalendarDays, Clapperboard, FileText, Handshake, LayoutGrid, Megaphone, Music4, Shirt } from "lucide-react";
+import { WORKSHOP_FORMATS, WORKSHOP_GROUPS, type PlayFormat } from "@/lib/chat/catalog";
+import { cn } from "@/lib/utils";
+
+export const WORKSHOP_ICON = {
+ brief: FileText,
+ board: LayoutGrid,
+ shots: Clapperboard,
+ style: Shirt,
+ photo: Aperture,
+ song: Music4,
+ calendar: CalendarDays,
+ campaign: Megaphone,
+ pitch: Handshake,
+} as const;
+
+/** A format's cover: its picture, or its colours and its line icon until the picture is made. */
+export function WorkshopCover({ format, className }: { format: PlayFormat; className?: string }) {
+ const Icon = WORKSHOP_ICON[format.icon];
+ return (
+ <span className={cn("relative block overflow-hidden", className)} style={{ background: `linear-gradient(150deg, ${format.accent[0]} 0%, ${format.accent[1]} 120%)` }} aria-hidden>
+ {format.cover ? (
+ // eslint-disable-next-line @next/next/no-img-element
+ <img src={format.cover} alt="" className="absolute inset-0 size-full object-cover" loading="lazy" />
+ ) : (
+ <Icon className="absolute top-[18%] left-1/2 size-[30%] -translate-x-1/2 text-white/80" strokeWidth={1} />
+ )}
+ </span>
+ );
+}
+
+/** The Workshop's formats in their three groups, as tall cards like the characters'. */
+export function WorkshopGrid({ onPick }: { onPick: (p: PlayFormat) => void }) {
+ return (
+ <div className="space-y-10">
+ {WORKSHOP_GROUPS.map((g) => (
+ <section key={g.id} aria-labelledby={`workshop-${g.id}`}>
+ <div className="mb-3.5 flex flex-wrap items-baseline gap-x-3 gap-y-1">
+ <h2 id={`workshop-${g.id}`} className="font-heading text-[26px] leading-none">
+ {g.label}
+ </h2>
+ <p className="text-[13.5px] text-muted-foreground">{g.note}</p>
+ </div>
+ <div className="grid grid-cols-2 gap-3 sm:grid-cols-3">
+ {WORKSHOP_FORMATS.filter((p) => p.group === g.id).map((p) => (
+ <button
+ key={p.id}
+ type="button"
+ onClick={() => onPick(p)}
+ className="group relative block w-full overflow-hidden rounded-[18px] text-left focus-visible:ring-4 focus-visible:ring-brand-faint focus-visible:outline-none"
+ aria-label={`${p.name}: ${p.blurb}`}
+ >
+ <WorkshopCover format={p} className="aspect-[4/5] w-full transition-transform duration-500 ease-out group-hover:scale-[1.03] motion-reduce:transition-none" />
+ <span className="pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/85 via-black/45 to-transparent p-3.5 pt-14 text-white">
+ <span className="block font-heading text-[21px] leading-tight sm:text-[23px]">{p.name}</span>
+ <span className="mt-1 line-clamp-2 block text-[12.5px] leading-snug text-white/80">{p.blurb}</span>
+ </span>
+ </button>
+ ))}
+ </div>
+ </section>
+ ))}
+ </div>
+ );
+}
diff --git a/src/lib/chat/catalog.ts b/src/lib/chat/catalog.ts
index 3069efa9..bf88f2ef 100644
--- a/src/lib/chat/catalog.ts
+++ b/src/lib/chat/catalog.ts
@@ -10,7 +10,7 @@ export const CHAT_KINDS: { id: ChatKind; label: string; hint: string; placeholde
{ id: "ideas", label: "Ideas", hint: "Concepts you can make in one tap", placeholder: "What should we come up with ideas for?" },
{ id: "write", label: "Write", hint: "Captions, bios, rewrites and scripts", placeholder: "Paste text to rewrite, or say what to write…" },
{ id: "character", label: "Characters", hint: "Stories with characters who stay in role", placeholder: "Pick a character below to start a story" },
- { id: "play", label: "Play", hint: "Quick, fun chats worth sharing", placeholder: "Pick a game below" },
+ { id: "play", label: "Workshop", hint: "Briefs, critiques, plans and songs", placeholder: "Pick a format below" },
];
export const isChatKind = (v: unknown): v is ChatKind => typeof v === "string" && CHAT_KINDS.some((k) => k.id === v);
@@ -138,81 +138,170 @@ export const WRITE_TOOLS: WriteTool[] = [
export const writeTool = (id: string | null | undefined) => WRITE_TOOLS.find((t) => t.id === id) ?? null;
// ---------------------------------------------------------------------------
-// Play formats
+// Workshop (the "play" kind): creative, artistic and productive formats, most ending in something to make
+
+export type WorkshopGroup = "creative" | "artistic" | "productive";
+
+export const WORKSHOP_GROUPS: { id: WorkshopGroup; label: string; note: string }[] = [
+ { id: "creative", label: "Creative", note: "From a rough idea to a plan you can shoot" },
+ { id: "artistic", label: "Artistic", note: "An expert eye on your work, and songs to make" },
+ { id: "productive", label: "Productive", note: "Plans and pitches, ready to send" },
+];
export interface PlayFormat {
id: string;
name: string;
blurb: string;
+ group: WorkshopGroup;
+ /** The card's icon (a lucide name the page maps) and colours, until its cover shows. */
+ icon: "brief" | "board" | "shots" | "style" | "photo" | "song" | "calendar" | "campaign" | "pitch";
+ accent: [string, string];
+ /** Its cover picture (4:5), when made. */
+ cover: string | null;
/** Takes a picture (the model sees it). */
picture?: boolean;
/** What the person fills in before it starts; empty: it starts at once. */
ask?: { label: string; placeholder: string };
- /** What the model is told the game is. */
+ /** What the model is told the job is. */
brief: string;
/** The first message sent for the person ({input} is what they typed). */
opener: string;
- emoji: string;
+ /** No longer offered: kept so chats started with it keep their instructions. */
+ retired?: boolean;
}
+const RETIRED = { group: "creative" as const, icon: "brief" as const, accent: ["#241a3a", "#6a5ee7"] as [string, string], cover: null, retired: true };
+
export const PLAY_FORMATS: PlayFormat[] = [
{
- id: "rate-my-look",
- name: "Rate my look",
- blurb: "A stylist's honest score for your outfit",
+ id: "creative-brief",
+ name: "Creative brief",
+ blurb: "A rough idea, turned into a one-page brief",
+ group: "creative",
+ icon: "brief",
+ accent: ["#2e2a26", "#c9a97a"],
+ cover: null,
+ ask: { label: "Your idea", placeholder: "A summer linen campaign shot on a Positano rooftop" },
+ brief:
+ "Turn the idea into a one-page creative brief with short sections: Objective, Audience, Big idea, Mood and look (palette, light, styling), References (describe each in one line), Deliverables (formats and sizes) and Timeline. End with one line \"Prompt (image): …\" for the hero visual.",
+ opener: "Write a creative brief for: {input}",
+ },
+ {
+ id: "moodboard",
+ name: "Moodboard in words",
+ blurb: "Palette, textures, light and styling, ready to make",
+ group: "creative",
+ icon: "board",
+ accent: ["#5b4636", "#c76b4a"],
+ cover: null,
+ ask: { label: "What it's for", placeholder: "A dark-romance fragrance launch" },
+ brief:
+ "Describe a moodboard in words: a palette of five colours (names and hex), textures and materials, light, wardrobe and styling, locations, and three reference images in one line each. End with three or four lines \"Prompt (image): …\", one for each board image.",
+ opener: "Build a moodboard for: {input}",
+ },
+ {
+ id: "shot-list",
+ name: "Shot list",
+ blurb: "A scene or campaign, shot by shot",
+ group: "creative",
+ icon: "shots",
+ accent: ["#0d1b2a", "#3a86ff"],
+ cover: null,
+ ask: { label: "The scene or campaign", placeholder: "A 30-second sneaker launch in a rainy city at night" },
+ brief:
+ "Write a numbered shot list of six to ten shots. For each: shot size, lens, camera move, light and what happens. After the list, add one line \"Prompt (video): …\" for each of the first three shots.",
+ opener: "Write a shot list for: {input}",
+ },
+ {
+ id: "style-critique",
+ name: "Style critique",
+ blurb: "A fashion editor's notes on an outfit",
+ group: "artistic",
+ icon: "style",
+ accent: ["#2b2140", "#b58b5a"],
+ cover: null,
picture: true,
brief:
- "You are a sharp, kind fashion editor. Score the outfit in the picture out of 10, then give: what works (two points), one change that would lift it, and a one-line verdict worth posting. Talk about the clothes, styling and colour, never the person's body.",
- opener: "Rate my look.",
- emoji: "🪞",
+ "You are a senior fashion editor. Give styling notes on the outfit in the picture: fit, proportion, colour, fabric and accessories. Then name the one change that would lift it most, and close with a short verdict. Talk about the clothes and the styling only.",
+ opener: "Give me styling notes on this look.",
},
{
- id: "roast",
- name: "Roast me, gently",
- blurb: "A friendly roast of your habits",
- ask: { label: "Tell it about yourself", placeholder: "I own 40 black t-shirts and call them all different" },
- brief: "Write a short, affectionate roast (5–7 lines) of the person from what they share. Clever, never cruel, nothing about looks, identity or anything they can't change. End with one genuine compliment.",
- opener: "Roast me, gently: {input}",
- emoji: "🔥",
+ id: "photo-critique",
+ name: "Photo critique",
+ blurb: "A picture editor's notes on your shot",
+ group: "artistic",
+ icon: "photo",
+ accent: ["#1c1c22", "#8c8c99"],
+ cover: null,
+ picture: true,
+ brief:
+ "You are a picture editor. Critique the photo: composition, light, colour and grade, focus and retouching. Suggest a stronger crop and two concrete ways to improve the next shot.",
+ opener: "Critique this photo.",
},
{
- id: "horoscope",
- name: "Style horoscope",
- blurb: "Today's outfit, written in the stars",
- ask: { label: "Your star sign", placeholder: "Leo" },
- brief: "Write today's playful style horoscope for the sign: the mood, a lucky colour, an outfit formula, one thing to avoid, and a one-line prophecy. Fun, specific and fashion-forward.",
- opener: "My sign is {input}. What's my style horoscope today?",
- emoji: "✨",
+ id: "song",
+ name: "Song and lyrics",
+ blurb: "A song written for you, ready to record",
+ group: "artistic",
+ icon: "song",
+ accent: ["#3b2a20", "#e0a458"],
+ cover: null,
+ ask: { label: "What the song is about", placeholder: "A slow-burn love song about a summer in Lisbon" },
+ brief:
+ "Write a short song: a title, two verses and a chorus with a clear hook. Then one line \"Prompt (music): …\" describing the genre, mood, instruments, tempo and voice, so the track can be made in one tap.",
+ opener: "Write a song about: {input}",
},
{
- id: "plot-twist",
- name: "Plot twist my day",
- blurb: "Your day, rewritten as a film",
- ask: { label: "What happened today", placeholder: "Missed the bus, spilled coffee, got a callback" },
- brief: "Retell the person's day as a dramatic film trailer: a title, a tagline, and 5–6 short trailer beats with a twist at the end. Cinematic, funny and warm.",
- opener: "Plot twist my day: {input}",
- emoji: "🎬",
+ id: "content-calendar",
+ name: "Content calendar",
+ blurb: "Two weeks of posts, with hooks and formats",
+ group: "productive",
+ icon: "calendar",
+ accent: ["#3e3a36", "#7fa6b8"],
+ cover: null,
+ ask: { label: "The brand or creator", placeholder: "A slow-fashion knitwear label on Instagram and TikTok" },
+ brief:
+ "Write a two-week content calendar as a list by day: the format (reel, carousel, story or post), the hook line and what it shows. Mix the formats, build to one hero post each week, and end with three lines \"Prompt (image): …\" for the hero posts.",
+ opener: "Plan two weeks of content for: {input}",
},
{
- id: "debate",
- name: "Two characters argue",
- blurb: "A tiny debate on any topic",
- ask: { label: "The topic", placeholder: "Is double denim ever okay?" },
+ id: "campaign-plan",
+ name: "Campaign plan",
+ blurb: "Concept, channels, assets and timeline",
+ group: "productive",
+ icon: "campaign",
+ accent: ["#1b263b", "#c1121f"],
+ cover: null,
+ ask: { label: "The product or launch", placeholder: "A capsule collection of silk scarves for spring" },
brief:
- "Write a short, funny debate between two invented characters with strong opinions (give each a name and a one-line description first). Six to eight lines, alternating, each line punchy. End with a surprising agreement.",
- opener: "Debate: {input}",
- emoji: "🎤",
+ "Write a campaign plan: the big idea in one line, the audience, the key message, channels, an asset list (each with its format and size), a four-week timeline and how to measure it. End with two lines \"Prompt (image): …\" for the hero assets.",
+ opener: "Plan a campaign for: {input}",
},
{
- id: "would-you-rather",
- name: "Would you rather",
- blurb: "Impossible choices, one at a time",
- brief: "Play would-you-rather. Ask one clever, creative or fashion-flavoured would-you-rather question at a time. After each answer, react in one line, then ask the next.",
- opener: "Let's play would you rather.",
- emoji: "🎲",
+ id: "client-pitch",
+ name: "Client pitch",
+ blurb: "The email, the scope and a price outline",
+ group: "productive",
+ icon: "pitch",
+ accent: ["#1f2a36", "#2e86ab"],
+ cover: null,
+ ask: { label: "Who and what", placeholder: "A boutique hotel in Capri, a summer brand film" },
+ brief:
+ "Write a client pitch: a short, specific email that opens with the idea, then the scope (deliverables and what's included), a simple price outline with two options, and a clear next step. Confident and warm, with no filler.",
+ opener: "Write a client pitch for: {input}",
},
+ // Retired: still read for chats that began with them.
+ { ...RETIRED, id: "rate-my-look", name: "Rate my look", blurb: "", picture: true, brief: "You are a sharp, kind fashion editor. Score the outfit in the picture out of 10, then give what works, one change that would lift it, and a one-line verdict.", opener: "Rate my look." },
+ { ...RETIRED, id: "roast", name: "Roast me, gently", blurb: "", brief: "Write a short, affectionate roast of the person from what they share. Clever and warm, ending with one genuine compliment.", opener: "Roast me, gently: {input}" },
+ { ...RETIRED, id: "horoscope", name: "Style horoscope", blurb: "", brief: "Write today's playful style horoscope for the sign: the mood, a lucky colour, an outfit formula and a one-line prophecy.", opener: "My sign is {input}. What's my style horoscope today?" },
+ { ...RETIRED, id: "plot-twist", name: "Plot twist my day", blurb: "", brief: "Retell the person's day as a dramatic film trailer: a title, a tagline and five or six short beats with a twist.", opener: "Plot twist my day: {input}" },
+ { ...RETIRED, id: "debate", name: "Two characters argue", blurb: "", brief: "Write a short, witty debate between two invented characters with strong opinions, ending with a surprising agreement.", opener: "Debate: {input}" },
+ { ...RETIRED, id: "would-you-rather", name: "Would you rather", blurb: "", brief: "Play would-you-rather, one clever question at a time, reacting to each answer in one line.", opener: "Let's play would you rather." },
];
+/** The formats the Workshop offers (retired ones stay readable for their chats). */
+export const WORKSHOP_FORMATS = PLAY_FORMATS.filter((p) => !p.retired);
+
export const playFormat = (id: string | null | undefined) => PLAY_FORMATS.find((p) => p.id === id) ?? null;
// ---------------------------------------------------------------------------
@@ -368,3 +457,6 @@ export const CHAT_LIMITS = {
greetingChars: 600,
shareMessages: 12,
};
+
+/** A format a new chat may start with (not a retired one). */
+export const workshopFormat = (id: string | null | undefined) => WORKSHOP_FORMATS.find((p) => p.id === id) ?? null;
diff --git a/src/lib/chat/prompt.ts b/src/lib/chat/prompt.ts
index 1389957c..ec908f0a 100644
--- a/src/lib/chat/prompt.ts
+++ b/src/lib/chat/prompt.ts
@@ -69,7 +69,7 @@ export function systemPrompt(s: ChatSetup): string {
);
} else if (s.kind === "play") {
const p = playFormat(s.play);
- if (p) parts.push(p.brief, "Keep it fun, quick and worth sharing. Never be mean about anything the person can't change.");
+ if (p) parts.push(p.brief, "Write as an expert in the field: specific, practical and ready to use as it is, with clear headings and no filler.");
} else parts.push(CHAT_EXTRA);
}
parts.push(s.mature ? MATURE : GENERAL);
diff --git a/src/server/chat/store.ts b/src/server/chat/store.ts
index e1e4ed4f..92c9b7de 100644
--- a/src/server/chat/store.ts
+++ b/src/server/chat/store.ts
@@ -1,6 +1,6 @@
import "server-only";
import crypto from "node:crypto";
-import { BUILT_IN_CHARACTERS, builtInCharacter, CHAT_LIMITS, isChatKind, playFormat, writeTool, type CharacterCard, type ChatKind } from "@/lib/chat/catalog";
+import { BUILT_IN_CHARACTERS, builtInCharacter, CHAT_LIMITS, isChatKind, playFormat, workshopFormat, writeTool, type CharacterCard, type ChatKind } from "@/lib/chat/catalog";
import { titleFrom } from "@/lib/chat/prompt";
import type { ChatEngine, ChatMessage, ChatPlan, ChatShareSnapshot, ChatThreadSummary, ChatThreadView } from "@/lib/chat/types";
import { generationAccount } from "../account-library";
@@ -276,7 +276,7 @@ export function createThread(who: string, t: NewThread): ChatThreadView {
if (t.kind === "character" && !character) throw new ChatError("Pick a character to chat with.", 404);
if (character?.mature && !t.mature) throw new ChatError("Turn on Mango Chilli mode to chat with this character.", 403, "mature-off");
const tool = t.kind === "write" ? (writeTool(t.tool)?.id ?? null) : null;
- const play = t.kind === "play" ? (playFormat(t.play)?.id ?? null) : null;
+ const play = t.kind === "play" ? (workshopFormat(t.play)?.id ?? null) : null;
const id = newId("ct");
const now = Date.now();
const title = clip(t.title, CHAT_LIMITS.titleChars) || (character ? character.name : tool ? writeTool(tool)!.name : play ? playFormat(play)!.name : "New chat");