rework to allow for image gen
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
This commit is contained in:
18
index.js
18
index.js
@@ -1,6 +1,7 @@
|
||||
import 'dotenv/config';
|
||||
import { generateDungeonPDF } from "./generateDungeon.js";
|
||||
import { generateDungeon } from "./dungeonGenerator.js";
|
||||
import { generateDungeonImages } from "./imageGenerator.js";
|
||||
import { generatePDF } from "./generatePDF.js";
|
||||
|
||||
// Utility to create a filesystem-safe filename from the dungeon title
|
||||
function slugify(text) {
|
||||
@@ -12,17 +13,20 @@ function slugify(text) {
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
// Generate dungeon JSON from Ollama
|
||||
// Generate the dungeon data
|
||||
const dungeonData = await generateDungeon();
|
||||
|
||||
// Optional: replace the map placeholder with your local map path
|
||||
// dungeonData.map = "/absolute/path/to/dungeon-map.png";
|
||||
// Generate dungeon map image (uses dungeonData.flavor)
|
||||
console.log("🖼️ Generating dungeon map image...");
|
||||
const mapPath = await generateDungeonImages(dungeonData);
|
||||
|
||||
// Generate a safe filename based on the dungeon's title
|
||||
dungeonData.map = mapPath;
|
||||
|
||||
// Generate PDF filename based on the title
|
||||
const filename = `${slugify(dungeonData.title)}.pdf`;
|
||||
|
||||
// Generate PDF
|
||||
await generateDungeonPDF(dungeonData, filename);
|
||||
// Generate the PDF using full dungeon data (including map)
|
||||
await generatePDF(dungeonData, filename);
|
||||
|
||||
console.log(`Dungeon PDF successfully generated: ${filename}`);
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user