chatbot-template/README.md

72 lines
3.5 KiB
Markdown
Raw Normal View History

2023-06-16 18:25:23 -04:00
<a href="https://chat.vercel.ai/">
<img alt="Chatbot" src="app/(chat)/opengraph-image.png">
<h1 align="center">Chatbot</h1>
2023-06-16 17:03:49 -05:00
</a>
<p align="center">
Chatbot (formerly AI Chatbot) is a free, open-source template built with Next.js and the AI SDK that helps you quickly build powerful chatbot applications.
2023-06-16 17:03:49 -05:00
</p>
<p align="center">
<a href="https://chatbot.dev"><strong>Read Docs</strong></a> ·
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> ·
2024-10-11 18:00:22 +05:30
<a href="#running-locally"><strong>Running locally</strong></a>
2023-06-16 17:03:49 -05:00
</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
2024-10-11 18:00:22 +05:30
- Advanced routing for seamless navigation and performance
- React Server Components (RSCs) and Server Actions for server-side rendering and increased performance
2025-09-08 10:57:49 +01:00
- [AI SDK](https://ai-sdk.dev/docs/introduction)
2024-10-11 18:00:22 +05:30
- Unified API for generating text, structured objects, and tool calls with LLMs
- Hooks for building dynamic chat and generative user interfaces
- Supports OpenAI, Anthropic, Google, xAI, and other model providers via AI Gateway
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)
2024-10-11 18:00:22 +05:30
- Component primitives from [Radix UI](https://radix-ui.com) for accessibility and flexibility
- Data Persistence
2025-04-09 16:22:20 -07:00
- [Neon Serverless Postgres](https://vercel.com/marketplace/neon) for saving chat history and user data
2024-10-11 18:00:22 +05:30
- [Vercel Blob](https://vercel.com/storage/blob) for efficient file storage
2025-04-09 16:22:20 -07:00
- [Auth.js](https://authjs.dev)
2024-10-11 18:00:22 +05:30
- Simple and secure authentication
2023-06-11 10:25:51 -04:00
## Model Providers
This template uses the [Vercel AI Gateway](https://vercel.com/docs/ai-gateway) to access multiple AI models through a unified interface. Models are configured in `lib/ai/models.ts` with per-model provider routing. Included models: Mistral, Moonshot, DeepSeek, OpenAI, and xAI.
### AI Gateway Authentication
**For Vercel deployments**: Authentication is handled automatically via OIDC tokens.
**For non-Vercel deployments**: You need to provide an AI Gateway API key by setting the `AI_GATEWAY_API_KEY` environment variable in your `.env.local` file.
With the [AI SDK](https://ai-sdk.dev/docs/introduction), you can also switch to direct LLM providers like [OpenAI](https://openai.com), [Anthropic](https://anthropic.com), [Cohere](https://cohere.com/), and [many more](https://ai-sdk.dev/providers/ai-sdk-providers) 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
You can deploy your own version of Chatbot to Vercel with one click:
2023-06-16 17:16:19 -05:00
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/templates/next.js/chatbot)
2023-06-17 09:18:55 +02:00
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 Chatbot. It's recommended you use [Vercel Environment Variables](https://vercel.com/docs/projects/environment-variables) for this, but a `.env` file is all that is necessary.
2023-06-11 10:25:51 -04:00
2025-03-14 19:00:22 -07:00
> Note: You should not commit your `.env` file or it will expose secrets that will allow others to control access to your various AI and authentication provider accounts.
2023-06-11 10:25:51 -04:00
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 db:migrate # Setup database or apply latest database changes
2023-06-11 10:25:51 -04:00
pnpm dev
```
2025-04-09 13:37:14 -07:00
Your app template should now be running on [localhost:3000](http://localhost:3000).