chatbot-template/README.md

74 lines
4.3 KiB
Markdown
Raw Normal View History

2023-06-16 18:25:23 -04:00
<a href="https://chat.vercel.ai/">
2023-06-16 19:20:54 -04:00
<img alt="Next.js 13 and app template Router-ready AI chatbot." src="https://chat.vercel.ai/opengraph-image.png">
2023-06-16 18:25:23 -04:00
<h1 align="center">Next.js AI Chatbot</h1>
2023-06-16 17:03:49 -05:00
</a>
<p align="center">
2023-06-16 19:21:34 -04:00
An open-source AI chatbot app template built with Next.js, the Vercel AI SDK, OpenAI, and Vercel KV.
2023-06-16 17:03:49 -05:00
</p>
<p align="center">
2023-06-16 21:16:30 -04:00
<a href="#features"><strong>Features</strong></a> ·
2023-06-16 17:03:49 -05:00
<a href="#model-providers"><strong>Model Providers</strong></a> ·
2023-06-16 17:16:19 -05:00
<a href="#deploy-your-own"><strong>Deploy Your Own</strong></a> ·
2023-06-16 17:03:49 -05:00
<a href="#running-locally"><strong>Running locally</strong></a> ·
<a href="#authors"><strong>Authors</strong></a>
</p>
<br/>
2023-06-16 21:16:30 -04:00
## Features
2023-05-19 14:25:15 -04:00
2023-06-16 19:21:57 -04:00
- [Next.js](https://nextjs.org) App Router
2023-06-11 10:25:51 -04:00
- React Server Components (RSCs), Suspense, and Server Actions
- [Vercel AI SDK](https://sdk.vercel.ai/docs) for streaming chat UI
2023-06-22 00:13:37 +09:00
- Support for OpenAI (default), Anthropic, Hugging Face, or custom AI chat models and/or LangChain
2023-06-11 10:25:51 -04:00
- Edge runtime-ready
2023-06-13 16:05:27 +04:00
- [shadcn/ui](https://ui.shadcn.com)
2023-06-11 10:25:51 -04:00
- Styling with [Tailwind CSS](https://tailwindcss.com)
- [Radix UI](https://radix-ui.com) for headless component primitives
2023-06-13 16:05:27 +04:00
- Icons from [Phosphor Icons](https://phosphoricons.com)
2023-06-11 10:25:51 -04:00
- Chat History, rate limiting, and session storage with [Vercel KV](https://vercel.com/storage/kv)
- [Next Auth](https://github.com/nextauthjs/next-auth) for authentication
2023-06-11 10:25:51 -04:00
## Model Providers
2023-06-22 00:13:37 +09:00
This template ships with OpenAI `gpt-3.5-turbo` as the default. However, thanks to the [Vercel AI SDK](https://sdk.vercel.ai/docs), you can switch LLM providers to [Anthropic](https://anthropic.com), [Hugging Face](https://huggingface.co), or using [LangChain](https://js.langchain.com) with just a few lines of code.
2023-06-11 10:25:51 -04:00
2023-06-16 17:16:19 -05:00
## Deploy Your Own
2023-06-16 18:23:17 -04:00
You can deploy your own version of the Next.js AI Chatbot to Vercel with one click:
2023-06-16 17:16:19 -05:00
2023-06-16 18:25:23 -04:00
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?demo-title=Next.js+Chat&demo-description=A+full-featured%2C+hackable+Next.js+AI+chatbot+built+by+Vercel+Labs&demo-url=https%3A%2F%2Fchat.vercel.ai%2F&demo-image=%2F%2Fimages.ctfassets.net%2Fe5382hct74si%2F4aVPvWuTmBvzM5cEdRdqeW%2F4234f9baf160f68ffb385a43c3527645%2FCleanShot_2023-06-16_at_17.09.21.png&project-name=Next.js+Chat&repository-name=nextjs-chat&repository-url=https%3A%2F%2Fgithub.com%2Fvercel-labs%2Fai-chatbot&from=templates&skippable-integrations=1&env=OPENAI_API_KEY%2CAUTH_GITHUB_ID%2CAUTH_GITHUB_SECRET&envDescription=How+to+get+these+env+vars&envLink=https%3A%2F%2Fgithub.com%2Fvercel-labs%2Fai-chatbot%2Fblob%2Fmain%2F.env.example&teamCreateStatus=hidden&stores=[{"type":"kv"}])
2023-06-16 17:16:19 -05:00
2023-06-17 09:18:55 +02:00
## Creating a KV Database Instance
Follow the steps outlined in the [quick start guide](https://vercel.com/docs/storage/vercel-kv/quickstart#create-a-kv-database) 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.
2023-06-11 10:25:51 -04:00
## Running locally
You will need to use the environment variables [defined in `.env.example`](.env.example) to run Next.js AI Chatbot. It's recommended you use [Vercel Environment Variables](https://vercel.com/docs/concepts/projects/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`
```bash
pnpm install
pnpm dev
```
2023-06-16 19:06:54 -04:00
Your app template should now be running on [localhost:3000](http://localhost:3000/).
2023-06-11 10:25:51 -04:00
## Authors
This library is created by [Vercel](https://vercel.com) and [Next.js](https://nextjs.org) team members, with contributions from:
- Jared Palmer ([@jaredpalmer](https://twitter.com/jaredpalmer)) - [Vercel](https://vercel.com)
- Shu Ding ([@shuding\_](https://twitter.com/shuding_)) - [Vercel](https://vercel.com)
2023-06-16 19:20:54 -04:00
- shadcn ([@shadcn](https://twitter.com/shadcn)) - [Contractor](https://shadcn.com)