Giter VIP home page Giter VIP logo

chatgpt_zulip_bot's Introduction

ChatGPT Zulip Bot

GitHub License Python Tests visitors

The ChatGPT Zulip Bot is a bot that responds to users by using the ChatGPT language model. It can be used in any Zulip chat streams or private messages.

Installation

  1. Clone the repository:
git clone https://github.com/yeahjack/chatgpt_zulip_bot.git
  1. Install the required dependencies (You might need to create a virtual env if you like):
pip install -r requirements.txt
  1. Set up your Zulip bot:
  • Go to your Zulip organization settings, and navigate to the "Your bots" section.
  • Click the "Add a new bot" button and follow the prompts to create a new bot.
  • Download the configuartion file and move it to this folder.
  • Rename config.ini.example to config.ini and fill in the values, note that you do not have to add commas (" ") around the values. Here are the explanations of parameters in config.ini.
Parameters Details
OPENAI_API_KEY Your OpenAI API Key. Could be set via this.
ZULIP_CONFIG The filename of your zulip bot configuration file.
USER_ID The ID of the admin. Used for notifications.
BOT_ID The ID of the zulip bot. Used for positioning.
API_VERSION The version of OpenAI models. e.g. gpt-3.5-turbo
  1. Start the bot:
python chatgpt_zulip_bot.py

Proxies

If you need to set a proxy for the OpenAI API, the normal method would be

import os
os.environ["http_proxy"] = "http://127.0.0.1:7890"
os.environ["https_proxy"] = "http://127.0.0.1:7890"

Remember to replace both strings to your proxy address and port.

Usage

To use the bot, mention it in any Zulip stream or send it a private message. You can mention the bot by typing @bot_name where the name is what you gave to the bot when you created it. Except normal texts, the bot also accepts the following commands

Commands

  • /help: print this usage information.
  • /end: end the current conversation. Bot will answer questions based on the context of the conversation. If a conversation reaches its 3000 token limit (you will see a message: "ERROR: OpenAI API rate limit exceeded. Please retry."), then you must restart the conversation with /end.

Testing

If you forked this repo and did some changes, you can run the tests to make sure everything is working fine. Each time you push a commit, the tests will be automatically run by GitHub Actions. Note that you need to set API_VERSION and OPENAI_API_KEY in GitHub secrets.

Contributing and bug reports

Feel free to leave an issue if you have any questions or suggestions. Pull requests are also welcomed. If you are interested in contributing this project, a good place to start is the chatgpt_zulip_bot.py and chatgpt.py files. You can customize the bot's behavior by modifying it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.