Skip to content

A MIT-licensed, deployable starter kit for building and customizing your own version of AI town - a virtual town where AI characters live, chat and socialize.

License

Notifications You must be signed in to change notification settings

a16z-infra/ai-town

Repository files navigation

AI Town 🏠🙍👷‍♀️💻💌

Installation

Clone repo and Install packages

git clone https://github.com/a16z-infra/AI-town
cd AI-town
npm install 
npx convex dev --typecheck=disable # select a new project 

nox convex dev will fail asking for OPENAI_API_KEY. ^C out

a. Set up Clerk

Go to https://dashboard.clerk.com/ -> "Add Application" -> Fill in Application name/select how your users should sign in -> Create Application

Now you should see both NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY on the screen. Add to .env.local

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_***
CLERK_SECRET_KEY=sk_***

Then go to JWT Templates and create a new Convex template. You'll need to copy the JWKS end point URL for use below.

b. OpenAI API key

Visit https://platform.openai.com/account/api-keys to get your OpenAI API key if you're using OpenAI for your language model.

e. Add secrets to the convex dashboard

npx convex dashboard

Go to "settings" and add the following environment varables. CLERK_ISSUER_URL should be the URL from the JWKS end point.

OPENAI_API_KEY  sk-*******
CLERK_ISSUER_URL  https://****

Run the code

To run both the front and and back end:

npm run dev

You can now visit http://localhost:[PORT_NUMBER]/ai-town

Various commands to run / test / debug

The following commands will clear the backend, seed it, and start it running

npx convex run init:reset
npx convex run init:seed
npx convex run engine:tick '{"worldId": "<world ID>"}'

To freeze the back end

npx convex run engine:freezeAll 
npx convex run engine:unfreezeAll  # when ready to rerun

To clear all databases

npx convex run --no-push init:debugClearAll # clear all tables

To Snoop on messages

Run the following in a side terminal

npx convex run chat:debugListMessages --no-push --watch off on a side terminal

About

A MIT-licensed, deployable starter kit for building and customizing your own version of AI town - a virtual town where AI characters live, chat and socialize.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published