This commit is contained in:
14
index.js
14
index.js
@@ -1,18 +1,25 @@
|
||||
import 'dotenv/config';
|
||||
import "dotenv/config";
|
||||
import { generateDungeon } from "./dungeonGenerator.js";
|
||||
import { generateDungeonImages } from "./imageGenerator.js";
|
||||
import { generatePDF } from "./generatePDF.js";
|
||||
import { DEFAULT_OLLAMA_MODEL } from "./ollamaClient.js";
|
||||
|
||||
// Utility to create a filesystem-safe filename from the dungeon title
|
||||
function slugify(text) {
|
||||
return text
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, '-') // replace non-alphanumeric with hyphens
|
||||
.replace(/^-+|-+$/g, ''); // trim leading/trailing hyphens
|
||||
.replace(/[^a-z0-9]+/g, "-") // replace non-alphanumeric with hyphens
|
||||
.replace(/^-+|-+$/g, ""); // trim leading/trailing hyphens
|
||||
}
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
if (!process.env.OLLAMA_API_URL) {
|
||||
throw new Error("OLLAMA_API_URL environment variable is required");
|
||||
}
|
||||
console.log("Using Ollama API URL:", process.env.OLLAMA_API_URL);
|
||||
console.log("Using Ollama model:", DEFAULT_OLLAMA_MODEL);
|
||||
|
||||
// Generate the dungeon data
|
||||
const dungeonData = await generateDungeon();
|
||||
|
||||
@@ -30,5 +37,6 @@ function slugify(text) {
|
||||
console.log(`Dungeon PDF successfully generated: ${filename}`);
|
||||
} catch (err) {
|
||||
console.error("Error generating dungeon:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user