Skip to content

Next.js Full Stack App. Build ChatGPT-like chatbots for your data. Easily organize files in folders

License

Notifications You must be signed in to change notification settings

denbondd/clarix

Repository files navigation


Logo

Clarix

Build ChatGPT-like chatbots that are aware of your data
View Demo on YouTube (1.4 min) »

Tech Stack · Getting Started · Contributing
Report Bug · Request Feature

Table of content

About the project

Full stack web application, written in Next.js App Router. Create custom ChatGPT-like chatbots for your data.

Features

  • Data organization - organize learning files in folders to easily tell Agents what to learn
  • Fully customizable agents - choose AI model, write System Prompt, choose temperature, select folders it should know and start talking with it!
  • Convenient chat interface - create separate chats for agents and start talking with them, with features like response streaming and answer regeneration
  • Response sources - view which chunks of your data AI used to generate every answer and percentage value on how similar it was to the topic of your question

Tech Stack

Technologies

UI

Libraries

  • ai - Vercel AI SDK, used for AI Model response streaming from the backend
  • Langchain - library for AI, used for creating embeddings
  • Zod - TypeScript-first schema validation with static type inference
  • React Hook Form - Performant, flexible and extensible forms with easy-to-use validation

Getting started

The project is self-hosted only, we might enable cloud hosting later if there will be a demand for this.

Prerequisites

To run the project, you will need the following env variables:

  • URL string to connect to the database. The project is configured for PostgreSQL, but you can easily change it to any SQL database or MongoDB (the project was not tested with other databases). Prisma docs about database connectors: ..link..
  • OpenAI API Key. You can change or add other providers in the code (src/app/api/kb/files/[fileId]/embeddings/route.ts and src/app/api/chat/[chatId]/route.ts files)
  • OAuth secrets for Auth.js. Project configured for GitHub OAuth, but you can easily change it to any other OAuth provider. email or credentials auth. Auth.js docs on providers: ..link..

Local Installation

  1. Clone this project via

    git clone https://github.com/denbondd/clarix.git
  2. Go to the project folder

    cd clarix
  3. Install packages with npm

    npm install
  4. Set up your .env file

  5. Set up your database running /sql/schema.sql

  6. Start using with

    npm run dev

Deployment

You can deploy it to Vercel with one click, but the free plan has only a 5s duration limit for serverless functions, which will throw 504 (Request Timeout) on embeddings creation (file creation) for large content. Also, keep in mind that your Database needs to be accessible from the web:

Deploy with Vercel

ToDo

  • Store large files' content in the files in S3 or any other object storage. Currently, content is stored in the files table. The get-content endpoint is separated from the get-file for this reason
  • Add the possibility to upload files in other formats (PDF, website crawl, video, etc)
  • Add the possibility to create a prompt template for agents. Require {context} and {question} fields
  • Configure adaptive mobile layout for every page (currently only for PC)
  • Enforse Server Side Rendering everywhere and create child client components for interactivity where needed
  • Your feature?

Contributing

Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

The source code in this repository is made available under the MPL-2.0 License.

Contact

Denys Bondarenko - @denbondd - denbon04@gmail.com

About

Next.js Full Stack App. Build ChatGPT-like chatbots for your data. Easily organize files in folders

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published