This is an ExpressJS server with an API endpoint to make changes to code files while streaming the results. It also handles detecting dependencies, and finding the matching versions for the LLM's knowledge cut-off.
Before running the server, ensure you have the following prerequisites installed on your system:
Before running the server, you need to set the following environment variables:
OPENAI_API_KEY
: (Required) Your OpenAI API keyHELICONE_API_KEY
: (Optional) Your Helicone API keyCLERK_API_KEY
: (Required) Your Clerk API key
To use, first install dependencies:
yarn install
To run in production mode:
yarn start
To run in development mode:
yarn dev
To run the server without authentication:
TESTING=true yarn dev
Below is an example API call without authentication:
curl 'http://localhost:3001/generate' \
-H 'content-type: application/json' \
--data-raw $'{"command":"Add a footer","code":"import React from \'react\'\\n\\nexport default function App() {\\n return (\\n <div className=\\"flex justify-center items-center h-screen\\">\\n <h1 className=\\"font-semibold\\">\\n Welcome to my app\u0021\\n </h1>\\n </div>\\n )\\n}"}' \
--compressed
To run with Docker:
docker build -t gitwit-server .
docker run -d -p 3001:3001 --env-file .env gitwit-server
First, install gitwit-server in your project using yarn link
.
Then, usage is as follows:
import { generateCode } from "gitwit-server";
const { code: newAppDotJS, dependencies } = await generateCode(
appDotJS,
prompt
);
This is mainly useful for running evaluations.