Skip to content

An AI monster generator web app using the Large Language Model (LLM) Cohere with the EntityFramework and Sqlite.

Notifications You must be signed in to change notification settings

primaryobjects/monster-collector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monster Collector

Ogre with purple bandaids and a temper that leaves crushed bones and broken dreams in its wake.

A simple database of AI-generated monsters.

About

Monster Collector is a simple web application to create a database of AI-generated monsters.

Monster names and descriptions are generated by the AI large language model (LLM) Cohere. Generated monsters are added to a table displayed on the page and saved to a local database. When generating a new monster, a custom prompt may be used to alter the type of monster created. The custom prompt is appended to the default prompt and allows customizing the type of generation from the LLM.

The table of monsters utilizes the contenteditable HTML attribute to allow inline editing of monster details. An ajax call triggers the save to an API method on the backend.

All data changes are saved in an audit log with the history stored in the database. Audit history is available by hovering your mouse over any row in the table.

Screenshot

Monster Collector screenshot

Quick Start

Install the required libraries in VSCode before running the project.

  1. Open a Terminal in VSCode.
  2. dotnet add package Microsoft.EntityFrameworkCore.Design
  3. dotnet add package Microsoft.EntityFrameworkCore.Sqlite
  4. dotnet tool install --global dotnet-ef
  5. Create a file Monster Collector/.env with the contents:
    CohereApiKey=<YOUR_API_KEY>
    OpenAIApiKey=<YOUR_API_KEY>
    

You can register a Cohere API key here.

You can register an OpenAI API key here.

Generate Monsters in the Database

To re-generate the monsters in the database, use the following steps.

  1. Delete the files MonsterManager.sqlite, MonsterManager.sqlite-shm, MonsterManager.sqlite-wal.

To re-generate the entire database, use the following steps.

  1. Delete the folder Migrations.
  2. dotnet ef migrations add InitialCreate
  3. dotnet ef database update

Customizing the Intensity of Monsters Created

Monsters that are generated by the LLM can be customized to almost any style by entering a custom prompt in the textbox provided. The custom prompt is appended onto the standard prompt used by the program when generating monsters.

Example 1: "A beautiful rainbow monster that is friendly and happy."

Example 2: "An extremely dramatic monster constructed from fancy fabrics from around the world."

API methods

GET /api/monster/{id}

Returns details for a specific monster by Id. The Id can be found in the table row data-id HTML attribute.

PUT /api/monster/{id}

Updates a specific monster by Id and payload.

POST /api/monster/

Generate a new monster.

DELETE /api/monster/{id}

Deletes a specific monster by Id.

Tech Stack

  • Visual Studio Code
  • C# .NET 8.0
  • MVC
  • Razor
  • EntityFramework
  • Sqlite
  • LLM Cohere and OpenAI

License

MIT

Author

Kory Becker http://www.primaryobjects.com/kory-becker