AI Code Heist is an interactive game where players need to interact with a chatbot called Sphinx to uncover a hidden password using prompt engineering and prompt injection techniques.
- Requirements
- Installation
- Environment Setup
- Running the Application
- Accessing the Application
- Docker Setup
- Helpful Links
- License
- Navigate to the
code-heist
directory:cd code-heist
- Install the dependencies:
npm install
- Start the development server:
npm run dev
- Create a Firebase account and download the
firebase-sdk.json
file. - Place the
firebase-sdk.json
file in theserver
directory. - Navigate to the
server
directory:cd server
- Create a virtual environment with Python 3.11+:
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install the required dependencies:
pip install -r requirements.txt
- Create an OpenAI account and get your API key from the OpenAI API documentation.
- Set up your environment variables:
- Create a
.env
file from.env.example
:cp .env.example .env
- Edit the
.env
file and set the following variables:OPENAI_API_KEY=<your_openai_api_key> ADMIN_KEY=<your_admin_key> SECRET_KEY=<your_secret_key> REDIS_URL=localhost REDIS_PORT=6379
- To generate the
ADMIN_KEY
, use the following Python script:import hashlib key = '<Choose an admin password>' print(hashlib.sha256(key.encode("utf-8")).hexdigest())
SECRET_KEY
can be any random long string
- Create a
- Install Redis server locally. Follow the Redis installation instructions.
- Start the Redis server:
redis-server
- Make sure your
firebase-sdk.json
file is in theserver
directory. - Activate your virtual environment:
source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Run the FastAPI server:
uvicorn main:app --reload
- Open your browser and go to http://localhost:5173 to access the main application.
- To access the admin panel, go to http://localhost:5173/admin.
- Use the password you generated for the
ADMIN_KEY
in the.env
file to log in. - Click Create Game to create a new game session.
- Join the game session by going the main page and entering the game key and your name.
- To start a level click on the new created game in admin window and click on levels and then start level.
To run the application using Docker, ensure you have Node.js installed and Docker Desktop set up.
- Once the environment file is in place and
firebase-sdk.json
downloaded, build the static files. - Navigate to the
code-heist
directory:cd code-heist
- Install the dependencies:
npm install
- Build the static files:
npm run deploy
- Navigate to the
server
directory:cd ../server
- Launch the Docker image that creates the Redis server and Uvicorn server:
docker compose up --build
- Install Node.js latest version
- Install Python 3.11
- Create a Firebase Account and get
firebase-sdk.json
- Create an OpenAI Account
- Install Redis Server
This project is licensed under the MIT License. See the LICENSE file for details.