No description
Find a file
2023-06-21 09:39:54 +08:00
app check chats length before run kv.pipeline() otherwise get empty pipeline 2023-06-21 02:01:22 +03:00
assets/fonts update font files 2023-06-17 22:31:32 +02:00
components Switch from TTF to WOFF to fix OG image size issue 2023-06-17 15:07:35 -05:00
lib Implement preview token for oss (#23) 2023-06-16 17:22:16 -04:00
public chore: add favicons 2023-06-15 16:02:02 +04:00
.env.example Update .env.example 2023-06-17 09:09:30 +02:00
.eslintrc.json chore: add eslint plugins for import and className sorting 2023-06-11 15:39:04 +04:00
.gitignore Don't commit vscode 2023-06-11 10:26:39 -04:00
auth.ts fix(ts): add back DefaultSession types 2023-06-20 16:50:12 +01:00
LICENSE Add Apache 2.0 license 2023-06-17 16:13:00 -04:00
middleware.ts Fix callback url 2023-06-16 16:53:34 -04:00
next-env.d.ts init 2023-05-19 12:33:56 -04:00
next.config.js More cleanup 2023-06-02 15:21:49 -04:00
package.json chore: upgrade next-auth 2023-06-20 17:22:04 +02:00
pnpm-lock.yaml chore: upgrade next-auth 2023-06-20 17:22:04 +02:00
postcss.config.js init 2023-05-19 12:33:56 -04:00
prettier.config.cjs Remove "@ianvs/prettier-plugin-sort-imports": "^3.7.2" 2023-06-11 11:15:39 -04:00
README.md Update README.md 2023-06-17 09:18:55 +02:00
tailwind.config.js fix: Repeated tailwind extend fontFamily 2023-06-21 09:39:54 +08:00
tsconfig.json chore: upgrade next-auth 2023-06-20 15:35:44 +02:00

Next.js 13 and app template Router-ready AI chatbot.

Next.js AI Chatbot

An open-source AI chatbot app template built with Next.js, the Vercel AI SDK, OpenAI, and Vercel KV.

Features · Model Providers · Deploy Your Own · Running locally · Authors


Features

  • Next.js App Router
  • React Server Components (RSCs), Suspense, and Server Actions
  • Vercel AI SDK for streaming chat UI
  • Support for OpenAI (default), Anthropic, HuggingFace, or custom AI chat models and/or LangChain
  • Edge runtime-ready
  • shadcn/ui
  • Chat History, rate limiting, and session storage with Vercel KV
  • Next Auth for authentication

Model Providers

This template ships with OpenAI gpt-3.5-turbo as the default. However, thanks to the Vercel AI SDK, you can switch LLM providers to Anthropic, HuggingFace, or using LangChain with just a few lines of code.

Deploy Your Own

You can deploy your own version of the Next.js AI Chatbot to Vercel with one click:

Deploy with Vercel

Creating a KV Database Instance

Follow the steps outlined in the quick start guide provided by Vercel. This guide will assist you in creating and configuring your KV database instance on Vercel, enabling your application to interact with it.

Remember to update your environment variables (KV_URL, KV_REST_API_URL, KV_REST_API_TOKEN, KV_REST_API_READ_ONLY_TOKEN) in the .env file with the appropriate credentials provided during the KV database setup.

Running locally

You will need to use the environment variables defined in .env.example to run Next.js AI Chatbot. It's recommended you use Vercel Environment Variables for this, but a .env file is all that is necessary.

Note: You should not commit your .env file or it will expose secrets that will allow others to control access to your various OpenAI and authentication provider accounts.

  1. Install Vercel CLI: npm i -g vercel
  2. Link local instance with Vercel and GitHub accounts (creates .vercel directory): vercel link
  3. Download your environment variables: vercel env pull
pnpm install
pnpm dev

Your app template should now be running on localhost:3000.

Authors

This library is created by Vercel and Next.js team members, with contributions from: