A ChatAI is a perplexity clone with multi-model support, integrating content scraping, source citation to mitigate hallucinations, and rate-limiting for scalability. Designed for accuracy, reliability, and a seamless AI-powered conversational experience.
- Node.js, Next.js
- Puppeteer, Cheerio
- Upstash Redis
- Groq API
- OpenAI API
- Node.js (v14 or later)
- API keys for Groq, Upstash Redis, and OpenAI
-
Clone the repository:
git clone https://github.com/raoakif/chatai.git
-
Navigate to the project directory:
cd chatai
-
Install dependencies:
npm install
-
Configure environment variables by creating a
.env
file with the following content:GROQ_API_KEY="" UPSTASH_REDIS_REST_URL="" UPSTASH_REDIS_REST_TOKEN=""
-
Start the development server:
npm run dev
-
Access the app at http://localhost:3000.
To deploy ChatAI to Vercel, follow these steps:
-
Fork the Repository
Fork the ChatAI repository to your GitHub account. -
Create a New Project on Vercel
- Go to Vercel and create a new project from your forked repository.
- Vercel will automatically detect the repository settings and install the necessary dependencies.
-
Configure Environment Variables
In the Vercel dashboard, go to the project settings and add the following environment variables:GROQ_API_KEY="" UPSTASH_REDIS_REST_URL="" UPSTASH_REDIS_REST_TOKEN=""
-
Deploy the Project
Click the Deploy button, and Vercel will automatically build and deploy your project. Once deployed, your ChatAI instance will be accessible via a Vercel-generated URL.
For more detailed deployment instructions, refer to the Vercel Documentation.
- Query Handling: Answer queries with context-rich, Markdown-formatted responses.
- Content Scraping: Utilize Puppeteer and Cheerio for web scraping to extract relevant content.
- Rate Limiting: Implement Upstash Redis for smooth handling of user requests.
- Source Citation: Reduce hallucinations by citing sources in answers.
-
src/app/page.tsx
Handle dynamic API responses and display user and AI chat interactions. -
src/app/api/chat/route.ts
Implement the chat API with Groq integration and web scraping using Puppeteer. -
src/middleware.ts
Manage rate-limiting logic via Upstash Redis.
-
Content Scraping Expansion:
Add support for scraping YouTube videos, PDFs, CSV files, and images. -
Data Visualization:
Integrate charts (e.g., bar charts, line charts) for enriched responses. -
Hierarchical Web Crawling:
Develop a crawler to scrape linked content from relevant pages.
👤 Rao Akif
Contributions, issues, and feature requests are welcome! Check the issues page for ongoing issues.
Give a ⭐️ if you like this project!
- Inspiration from Perplexity.ai
- Thanks to all contributors and the libraries used in this project.
This project is licensed under the MIT License.