Estilo Cartoon (Remotion), personagens reaproveitáveis e hashtags do TikTok
Estilo Cartoon (novo, sem Godot) - Pacote cartoon/ (Remotion 4.0.535): cada trecho é um spec JSON desenhado em React/SVG e renderizado em MP4; render em lote (empacota uma vez) e imagem parada (--still). - Cenas montadas por peças, sem cenário pronto: paletas (noite, sépia, dia, entardecer, cinza), lugar com chão, interno/externo, névoa e 24 peças posicionadas por profundidade, foco de luz e vinheta; etiquetas, onomatopeias, ondas de som, X vermelho, painel do topo e legenda palavra por palavra. - Montagem documental: "Cartoon" como estilo do vídeo e tipo de visual do trecho; plano por regras pelo texto (lugar, objetos, expressão, pose), tempos das palavras pela transcrição do áudio, "Gerar de novo" por trecho, paleta da série e elenco da história. Personagens - Aba Personagens: criar pela descrição, ajustar peça por peça com prévia ao vivo, refinar com o agente (tarefa nova "Personagem"); fichas em assets/characters/ e elenco em stories/<id>/cast.json. O mesmo personagem sai igual em qualquer cena, mudando expressão, pose e objeto na mão. TikTok - Hashtags passam a ser digitadas e confirmadas na lista de sugestões do TikTok Studio (coladas, viravam texto). Diagnóstico de alcance em doc/publicacao/TIKTOK_DIAGNOSTICO.md. Docs: estudo das referências, doc/cartoon/ (personagens e cenas) e skill cenaforge 1.46.0. Testes: painel 77/77, cartoon 5/5, Publicador 87/87. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { defaultModelFor, defaultProviderFor, startRun } from "@/lib/agents";
|
||||
import { characterFileRel, getCharacter } from "@/lib/characters";
|
||||
import { errorResponse, readJson } from "@/lib/http";
|
||||
import { UserError } from "@/lib/stories";
|
||||
|
||||
type Ctx = { params: Promise<{ id: string }> };
|
||||
|
||||
/** POST — pede ao agente (tarefa "Personagem") para refinar a aparência pela descrição. → {runId}. */
|
||||
export async function POST(request: Request, ctx: Ctx) {
|
||||
try {
|
||||
const { id } = await ctx.params;
|
||||
const character = getCharacter(id);
|
||||
if (!character) throw new UserError("Personagem não encontrado.");
|
||||
const body = await readJson<{ note?: string }>(request).catch(() => ({} as { note?: string }));
|
||||
const provider = defaultProviderFor("character");
|
||||
const run = startRun({
|
||||
provider, model: defaultModelFor("character", provider), kind: "character",
|
||||
request: `Personagem ${id} (arquivo ${characterFileRel(id)}): ${character.name}. ${character.description ?? ""} ${String(body.note ?? "").slice(0, 600)}`.trim(),
|
||||
});
|
||||
return Response.json({ runId: run.id });
|
||||
} catch (error) {
|
||||
return errorResponse(error);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { deleteCharacter, getCharacter, saveCharacter } from "@/lib/characters";
|
||||
import { errorResponse, readJson } from "@/lib/http";
|
||||
import { UserError } from "@/lib/stories";
|
||||
|
||||
type Ctx = { params: Promise<{ id: string }> };
|
||||
|
||||
export async function GET(_request: Request, ctx: Ctx) {
|
||||
try {
|
||||
const character = getCharacter((await ctx.params).id);
|
||||
if (!character) throw new UserError("Personagem não encontrado.");
|
||||
return Response.json(character);
|
||||
} catch (error) {
|
||||
return errorResponse(error);
|
||||
}
|
||||
}
|
||||
|
||||
/** PUT — salva nome, legenda, descrição, tipo e aparência (o id não muda). */
|
||||
export async function PUT(request: Request, ctx: Ctx) {
|
||||
try {
|
||||
const { id } = await ctx.params;
|
||||
const body = await readJson<Record<string, unknown>>(request);
|
||||
return Response.json(saveCharacter({ ...body, id }));
|
||||
} catch (error) {
|
||||
return errorResponse(error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function DELETE(_request: Request, ctx: Ctx) {
|
||||
try {
|
||||
deleteCharacter((await ctx.params).id);
|
||||
return Response.json({ ok: true });
|
||||
} catch (error) {
|
||||
return errorResponse(error);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { describeToLook, listCharacters, saveCharacter } from "@/lib/characters";
|
||||
import { errorResponse, readJson } from "@/lib/http";
|
||||
|
||||
/** GET /api/characters — a biblioteca de personagens. */
|
||||
export async function GET() {
|
||||
try {
|
||||
return Response.json(listCharacters());
|
||||
} catch (error) {
|
||||
return errorResponse(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /api/characters — cria um personagem: {name, description?, kind?}. A aparência sai da descrição (regras);
|
||||
* depois dá para ajustar no formulário ou pedir ao agente.
|
||||
*/
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
const body = await readJson<{ name?: string; description?: string; kind?: string }>(request);
|
||||
const description = String(body.description ?? "");
|
||||
const draft = describeToLook(`${body.name ?? ""} ${description}`);
|
||||
return Response.json(saveCharacter({ name: body.name, description, kind: body.kind, look: draft.look, caption: draft.caption }, true));
|
||||
} catch (error) {
|
||||
return errorResponse(error);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { getCast, setCast } from "@/lib/characters";
|
||||
import { errorResponse, readJson } from "@/lib/http";
|
||||
import { UserError, getStory } from "@/lib/stories";
|
||||
|
||||
type Ctx = { params: Promise<{ storyId: string }> };
|
||||
|
||||
async function storyOf(ctx: Ctx): Promise<string> {
|
||||
const { storyId } = await ctx.params;
|
||||
if (!getStory(storyId)) throw new UserError("História não encontrada.");
|
||||
return storyId;
|
||||
}
|
||||
|
||||
/** GET — elenco da história (personagens da biblioteca). */
|
||||
export async function GET(_request: Request, ctx: Ctx) {
|
||||
try {
|
||||
return Response.json(getCast(await storyOf(ctx)));
|
||||
} catch (error) {
|
||||
return errorResponse(error);
|
||||
}
|
||||
}
|
||||
|
||||
/** PUT {cast: ["id", ...]} — troca o elenco (até 12). */
|
||||
export async function PUT(request: Request, ctx: Ctx) {
|
||||
try {
|
||||
const storyId = await storyOf(ctx);
|
||||
const body = await readJson<{ cast?: unknown }>(request);
|
||||
return Response.json(setCast(storyId, body.cast));
|
||||
} catch (error) {
|
||||
return errorResponse(error);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { CharacterStudio } from "@/components/character-studio";
|
||||
import { UsersIcon } from "@/components/icons";
|
||||
import { Meta, PageHeader } from "@/components/ui";
|
||||
import { listCharacters } from "@/lib/characters";
|
||||
|
||||
export const metadata = { title: "Personagens" };
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default function CharactersPage() {
|
||||
return (
|
||||
<>
|
||||
<PageHeader eyebrow="Biblioteca" title="Personagens"
|
||||
description="Crie um personagem uma vez e use em qualquer história: no estilo Cartoon ele sai igual em todas as cenas, mudando só expressão, pose e o que tem na mão."
|
||||
meta={<Meta icon={<UsersIcon size={15} />}>Montado por peças · elenco escolhido em cada história</Meta>} />
|
||||
<CharacterStudio initial={listCharacters()} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -164,8 +164,8 @@ export default async function EpisodePage({ params }: { params: Promise<{ storyI
|
||||
|
||||
{documentary && script && (
|
||||
<Card className="order-first" eyebrow={<><ClapperIcon size={12} />Montagem</>} title="Montagem do vídeo"
|
||||
description="Um áudio por trecho (a voz fica natural) e um visual por trecho: foto, animação 2D, cena 3D do Godot, clipe ou cartela. Dá para misturar.">
|
||||
<MontageEditor episodeId={ep.id} />
|
||||
description="Um áudio por trecho (a voz fica natural) e um visual por trecho: foto, animação 2D, cena 3D do Godot, Cartoon, clipe ou cartela. Dá para misturar.">
|
||||
<MontageEditor episodeId={ep.id} storyId={story.id} />
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user