Skip to content

Commit

Permalink
Merge pull request #58 from vicentefelipechile/master
Browse files Browse the repository at this point in the history
Big changes to main repository
  • Loading branch information
Zain-ul-din authored Oct 18, 2024
2 parents f0ca8ec + be80dc8 commit 050002f
Show file tree
Hide file tree
Showing 38 changed files with 716 additions and 2,873 deletions.
36 changes: 31 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
OPENAI_API_KEY=ADD_YOUR_KEY
DREAMSTUDIO_API_KEY=ADD_YOUR_KEY
GEMINI_API_KEY=ADD_YOUR_KEY
HF_TOKEN=HUGGING_FACE_TOKEN
MONGO_URL=YOUR_MONGO_DB_URL
DEBUG=True

# Model Services
API_KEY_OPENAI=ADD_YOUR_KEY
API_KEY_DREAMSTUDIO=ADD_YOUR_KEY
API_KEY_GEMINI=ADD_YOUR_KEY
API_KEY_HF=HUGGING_FACE_TOKEN

# Optional
# API_KEY_OPENAI_DALLE=ADD_YOUR_KEY

# MongoDB
MONGO_ENABLED=True
MONGO_URL=YOUR_MONGO_DB_URL


# Service Settings
# # OpenAI
OPENAI_PREFIX=!chatgpt
OPENAI_ENABLED=False
OPENAI_ICON_PREFIX=🤖

DALLE_PREFIX=!dalle
DALLE_ENABLED=True
DALLE_ICON_PREFIX=🎨
DALLE_USE_3=False

# # Google Gemini
GEMINI_PREFIX=!gemini
GEMINI_ENABLED=True
GEMINI_ICON_PREFIX=🔮
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@


package-lock.json
yarn.lock
159 changes: 159 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@

> [!NOTE]
> We are switching to the [@whiskeysockets/baileys](https://github.com/WhiskeySockets/Baileys) library for our bot because it's lightweight and easy to deploy.
>
> This branch is still under construction 🚧. Currently, we only support the models listed below, but support for new models will be added soon.
<div align="center">

# <img src="https://github.com/Zain-ul-din/whatsapp-ai-bot/assets/78583049/d31339cf-b4ae-450e-95b9-53d21e4641a0" width="35" height="35"/> WhatsApp AI Bot 🚀

</div>

The WhatsApp AI Bot is a chatbot that uses AI models APIs to generate responses to user input. The bot supports several AI models, including **`Gemini`**, **`ChatGPT`** and **`DALL-E`**..

> [!NOTE]
> Custom models aren't supported for now, but we are working on it.
# Table of Content

- [Demo](#demo)
- [Usage](#usage)
- [Tutorials](#Tutorials)
- [Docs](docs/config-docs.md)
- [Disclaimer](#disclaimer)
- [Contributors](#contributors)
- [Sponsors](#Sponsors)
- [About](#about-us)

# Supported Models

| Model | Provider | Type | Command |
| ----- | -------- | ---- | ------- |
| ChatGPT | [OpenAI](https://platform.openai.com/docs/guides/text-generation/quickstart) | Text to Text | !chatgpt |
| Gemini | [Google](https://ai.google.dev/gemini-api/docs/text-generation?lang=node#generate-text-from-text) | Text to Text | !gemini |
| Gemini Vision | [Google](https://ai.google.dev/gemini-api/docs/vision?lang=node#upload-image) | Image to Text | none |
| Dalle 2 & 3 | [OpenAI](https://platform.openai.com/docs/api-reference/images/create) | Text to Image | !dalle |

# Demo

### Gemini

<details>
<summary>Click to see the demo</summary>

[![Screenshot (1186)](https://github.com/Zain-ul-din/whatsapp-ai-bot/assets/78583049/b6f256de-c792-4947-bf65-401a60a0b1f4)](https://www.youtube.com/watch?v=dXDxTQQqeq8)

</details>

### Stability AI + Chat-GPT

<details>
<summary>Click to see the demo</summary>

![image](https://user-images.githubusercontent.com/78583049/222071673-ef0f2021-a8b4-4263-9304-a77ecd76c0a1.png)

</details>

### Dalle + Custom Model

<details>

<summary>Click to see the demo</summary>

![image](https://user-images.githubusercontent.com/78583049/222074174-55792d13-5137-4c1c-b708-3ad188ca8d8d.png)

</details>

---

# Usage

### 1. Download Source Code

```bash
git clone https://github.com/Zain-ul-din/WhatsApp-Ai-bot.git
cd WhatsApp-Ai-bot
```

> OR
- [Download Zip File](https://github.com/Zain-ul-din/WhatsApp-Ai-bot/archive/refs/heads/master.zip)

### 2. Get API Keys

- [Gemini API Key](https://aistudio.google.com/app/apikey)
- [OpenAI API Key](https://platform.openai.com/api-keys)
- [StabilityAI API Key](https://platform.stability.ai/account/keys)

### 3. Add API Keys

Copy the file `.env.example` and rename it to `.env`, then set any settings you want to change.

### 4. Run the code

- Run `npm run start` to run the bot.

- Scan QR code.

# Default Settings

- `!gemini` use gemini.
- `!chatgpt` use chat-gpt.
- `!dalle` use Dalle.

**Note! open `src/whatsapp-ai.config.ts` to edit config.**

[Docs Link](docs/config-docs.md)

# Tutorials

- **[Setup bot on cloud using Github code-spaces](https://www.youtube.com/watch?v=QahJSi6Ygj4)**
- **[setup bot on a local machine](https://www.youtube.com/watch?v=fyPD3ILFPck)**

### FQA

- [How to create custom model](https://github.com/Zain-ul-din/whatsapp-ai-bot/issues/3)

# Disclaimer

This bot utilizes Puppeteer to operate an actual instance of Whatsapp Web to prevent blocking. However, it is essential to note that these operations come at a cost charged by OpenAI and Stability AI for every request made. Please be aware that WhatsApp does not support bots or unofficial clients on its platform, so using this method is not entirely secure and could lead to getting blocked.

## Contributors

<a href="https://github.com/Zain-ul-din/WhatsApp-Ai-bot/graphs/contributors">
<img src="https://contrib.rocks/image?repo=Zain-ul-din/WhatsApp-Ai-bot" />
</a>

###

- [Open issue here](./../../issues)
- [Ask Question here](./../../discussions)

<!-- about -->

## Sponsors

A big thank you to these people for supporting this project.

| ![Levitco](https://avatars.githubusercontent.com/u/47256157?v=4&s=128) | ![Anas Ashfaq](https://avatars.githubusercontent.com/u/119153707?v=4&s=128) | <img src="https://avatars.githubusercontent.com/u/0?v=4" width="150" height="150"/> |
| --- | --- | --- |
| Levitco | Anas Ashfaq | YOU? |

# Useful links

| ♥ Sponsor | 💎 Bounty | 🚀 Deployment | ✉ WhatsApp Group |
| ------- | ------ | ---------- | --------------- |
| [Link](https://buymeacoffee.com/zainuldin) | [Link](https://wa-ai-seven.vercel.app/feat-req) | [Link](https://wa-ai-seven.vercel.app/) | [Link](https://chat.whatsapp.com/DlVCpX2QQNx6jHQVT9IB7Z) |

## About Us

<div align="center">
<h4 font-weight="bold">This repository is maintained by <a href="https://github.com/Zain-ul-din">Zain-Ul-Din</a></h4>
<p> Show some ❤️ by starring this awesome repository! </p>
</div>

<div align="center">
<a href="https://www.buymeacoffee.com/zainuldin" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>

</div>
63 changes: 0 additions & 63 deletions baileys/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"scripts": {
"dev": "vite-node ./src/index.ts",
"start": "npx yarn dev",
"start": "npx yarn && npx yarn dev",
"format": "prettier --write ./src",
"test": "vite-node ./test/index.test.ts",
"test:baileys": "vite-node ./baileys/index.ts",
Expand Down
Loading

0 comments on commit 050002f

Please sign in to comment.