ChatHive is a powerful AI-driven chatbot application designed for interactive document-based conversations. Leverage GPT-4 for conversational intelligence, Pinecone for vector-based document retrieval, MongoDB for scalable chat history storage, and a modern frontend built with Next.js, React, and TailwindCSS.
🚀 Deployed Version: (Access restricted to maintain API key security. Follow instructions below to run or deploy your own instance.)
- Multi-Topic Conversations: Create and manage multiple topics to chat about.
- Document Uploads: Upload
.pdf
,.docx
, or.txt
files for AI-based retrieval and discussions. - Embedded Storage: Automatically convert files to embeddings and store them in Pinecone namespaces.
- Chat Management: Maintain multiple chats per topic with automatic MongoDB-based history retrieval.
- Integrated OAuth: Google OAuth for secure user login and personalized chat storage.
- In-Browser Management: Create, manage, and delete Pinecone namespaces directly from the browser.
Backend Tools: LangChain, Pinecone, OpenAI GPT-4.
Frontend: Fully responsive design with TailwindCSS.
Follow the instructions below to set up and run ChatHive locally.
git clone https://github.com/hisachin/chathive.git --branch master
- Create an account on Pinecone.
- Go to Indexes > Create Index:
- Name: Choose any name.
- Dimensions: Set to
1536
(required for OpenAI embeddings) or Set to384
(required for HiggingFace embeddings). - Leave other fields as default.
- Navigate to API Keys and create a new key.
- Save the API Key and Environment values.
- Create an account on MongoDB.
- In your dashboard:
- Click New Project > Create Project.
- Under Database Deployments, click Build a Database:
- Choose M0 FREE for a free-tier cluster.
- Fill out cluster details and click Create.
- Add your current IP address to the access list.
- Under Connect > Drivers, copy the MongoDB URI.
- Replace
<password>
in the URI with the password you set for your database user.
- Go to Google Developer Console and create a new project.
- Under APIs & Services:
- Go to OAuth Consent Screen > External > Fill out details.
- Add
.../auth.userinfo.email
scope. - Add yourself as a Test User.
- Under Credentials:
- Create OAuth Client ID:
- Authorized JavaScript Origins:
http://localhost:3000
- Authorized Redirect URIs:
http://localhost:3000/api/auth/callback/google
- Authorized JavaScript Origins:
- Save the Client ID and Client Secret.
- Create OAuth Client ID:
yarn install
- Run the following command to start the development server:
npm run dev
- Once the local development environment launches, you can access the app at http://localhost:3000.
- After logging in with Google, go to Settings at the bottom left corner.
- Upload your files and assign them a namespace. In this context, a namespace is synonymous with the topic of your conversation.
- You can upload multiple files to different namespaces and maintain multiple conversations about various topics and documents.
- On the home page, you will see your namespace(s) on the left sidebar.
- Click on a namespace to open it, create a new chat, and start a conversation with the files embedded for that particular namespace.
- Ensure your Node.js version is up-to-date by running node -v.
- If you're encountering issues with a specific file, try converting it to text first or use a different file. It's possible that the file is corrupted, scanned, or requires OCR (Optical Character Recognition) to convert it to text.
- Double-check your environment variables and make sure they are properly exposed and configured.
- Ensure you're using the correct versions of LangChain and Pinecone as required by this repository.
- Verify that your .env file contains valid API keys, environment settings, and index names.
- Ensure that your Pinecone dashboard environment and index match the values you provided in your .env file.
- Confirm that the vector dimensions are set to 1536 as required by OpenAI embeddings.
- If you're on the Starter (free) plan, be aware that Pinecone indexes are deleted after 7 days of inactivity. To prevent this, send an API request to Pinecone to refresh activity before the 7-day period ends.
- If issues persist, try starting fresh with a new Pinecone project, index, and a cloned repository.
- The frontend of this repository is inspired by the GPT-4 & LangChain repository by mayooear.
- Significant customizations have been made to enhance features and integrations for this specific project.