import express from "express"; import cors from "cors"; const app = express(); app.use(cors()); app.use(express.json()); /* ========================= 🧠 MEMORY SYSTEM ========================= */ const characters = { boy: { name: "Ren", description: "handsome anime boy, black messy hair, blue eyes, school uniform, calm, protective" }, girl: { name: "Aiko", description: "cute anime girl, short black hair, brown eyes, shy, soft, school uniform" } }; const relationship = { dynamic: "soft caring bond", emotion: "protective and gentle", closeness: 1 }; /* ========================= 🎭 PROMPT BUILDER ========================= */ function buildPrompt() { return ` anime manga style, high quality, consistent characters: boy: ${characters.boy.description} girl: ${characters.girl.description} relationship: ${relationship.dynamic}, ${relationship.emotion} `; } /* ========================= 📖 PANEL GENERATOR ========================= */ function generatePanels(scene) { return [ { type: "wide", prompt: `${scene}, classroom`, dialogue: "", speaker: "none" }, { type: "close", prompt: `${characters.girl.name} sleepy`, dialogue: "...mm...", speaker: "girl", emotion: "sleepy" }, { type: "mid", prompt: `${characters.boy.name} notices her`, dialogue: "She's really tired...", speaker: "boy", emotion: "soft" }, { type: "dialogue", prompt: "teacher angry", dialogue: "Pay attention!", speaker: "teacher", emotion: "angry" }, { type: "close", prompt: `${characters.boy.name} gentle`, dialogue: "It's okay...", speaker: "boy", emotion: "soft" }, { type: "emotion", prompt: `${characters.girl.name} embarrassed`, dialogue: "S-sorry...", speaker: "girl", emotion: "embarrassed" }, { type: "final", prompt: `${characters.boy.name} comforting ${characters.girl.name}`, dialogue: "You can rest. I got you.", speaker: "boy", emotion: "protective" } ]; } /* ========================= 🔥 API ========================= */ app.post("/generate", (req, res) => { const { scene } = req.body; const base = buildPrompt(); const panels = generatePanels(scene); const result = panels.map((p, i) => ({ id: i, prompt: base + ", " + p.prompt, dialogue: p.dialogue, speaker: p.speaker, emotion: p.emotion || "" })); res.json(result); }); /* ========================= 🌐 FRONTEND (INLINE) ========================= */ app.get("/", (req, res) => { res.send(` Manga AI Generator

💜 Manga AI Page Generator



`); }); /* ========================= */ app.listen(3000, () => { console.log("🔥 http://localhost:3000"); });