Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/primaryobjects/monster-collector

An AI monster generator web app using the Large Language Model (LLM) Cohere with the EntityFramework and Sqlite.
https://github.com/primaryobjects/monster-collector

ai cohere csharp database dotnet entityframeworkcore large-language-model linq llm sqlite web webapp

Last synced: 10 days ago
JSON representation

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

Awesome Lists containing this project

README

        

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](https://cohere.com). 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](Monster%20Collector/Managers/MonsterFactory.cs#L31-L37) 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](Monster%20Collector/wwwroot/js/site.js) 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](screenshot.png)

## 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=
OpenAIApiKey=
````

*You can register a Cohere API key [here](https://dashboard.cohere.com/api-keys).*

*You can register an OpenAI API key [here](https://platform.openai.com/account/api-keys).*

## 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](Monster%20Collector/Managers/MonsterFactory.cs#L31-L37) 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