Skip to content

lvwzhen/teach-anything

 
 

Repository files navigation

Teach you anything in seconds use AI.

2023-02-04.22.43.56.mov

Sponsor

MagickPen BetterPrompt OpenL
Talentorg SailboatUI ❤️ Your logo

Language support

English, Simplified Chinese, Traditional Chinese, Japanese, Italian, German, Spanish,French,Dutch ,Korean,Khmer, Hindi

PR welcome

How it works

Inspired by TwtterBio and Danny Richman

Powered by OpenAI, Next.js, Cloudflare Workers and Tailwind CSS.

This project uses the OpenAI Chat Completions API with streaming. It constructs a prompt based on the form and user input, sends it to /api/generate, then streams the response back to the application.

The app is deployed on Cloudflare using OpenNext for Cloudflare.

Running Locally

Create a .env file based on .env.example:

OPENAI_API_KEY=your_key
OPENAI_BASE_URL=your_openai_base_url
OPENAI_MODEL=your_openai_model

Then, run the application in the command line and it will be available at http://localhost:3000.

npm run dev

Deploy to Cloudflare Workers

Install dependencies:

npm install

Login to Cloudflare:

npx wrangler login

Set Cloudflare runtime variables in dashboard:

  • OPENAI_API_KEY (Secret)
  • OPENAI_MODEL (Variable or Secret, optional override)
  • OPENAI_BASE_URL (Variable or Secret, optional override)

Or via CLI:

npx wrangler secret put OPENAI_API_KEY
npx wrangler secret put OPENAI_MODEL
npx wrangler secret put OPENAI_BASE_URL

Build and preview on the Cloudflare runtime:

npm run build:cf
npm run preview:cf

Deploy:

npm run deploy:cf

About

Teach any questions in seconds (by OpenAI)

Topics

Resources

Stars

Watchers

Forks

Sponsor this project

Contributors

Languages

  • TypeScript 94.4%
  • CSS 4.2%
  • JavaScript 1.4%