Skip to content

Jinksi/gpt-experiments

Repository files navigation

See src/pages/api/ for API endpoints that call ChatGPT models

Local Development

Add a .env.local file to the root of the project with your OpenAI API key:

OPENAI_API_KEY=sk_....

Run the development server:

npm run dev

Open http://localhost:3000 with your browser to see the result.

Indexing documentation web pages

npm run fetch-docs

This will crawl the documentation pages listed in scripts/fetch-docs.ts, create OpenAI embeddings and store them in a vector store: public/vectorstores/.

This is a one-time operation that you only need to run when you want to update the documentation pages that are indexed.

This vector store is used by the ChatGPT model to find the most relevant documentation page for a given query.

Deploying

First, install the Fly CLI.

Then, run:

npm run deploy

This will deploy the app to Fly.io, which includes a build step (see Dockerfile).