Giter Site home page Giter Site logo

llmkira / openaibot Goto Github PK

View Code? Open in Web Editor NEW
1.9K 21.0 229.0 18.31 MB

⚡️ Build Your Own chatgpt Bot|🧀 Discord/Slack/Kook/Telegram |⛓ ToolCall|🔖 Plugin Support | 🌻 out-of-box | gpt-4o

Home Page: https://llmkira.github.io/Docs

License: Apache License 2.0

Python 99.46% Shell 0.34% Dockerfile 0.20%
openai assistant discordbot kook-bot slack-bot gpt-4-vision-preview gpt-4 chat-gpt gpt-4o gpt-4o-mini

openaibot's Introduction

cover


docker docker workflow
telegram discord
license docker build

🍩 Deploy Docs & 🧀 Dev Docs & 🤝 Contribute

Don't hesitate to Star ⭐️, Issue 📝, and PR 🛠️

Python>=3.9

This project uses the ToolCall feature.

It integrates a message queuing and snapshot system, offering plugin mechanisms and authentication prior to plugin execution.

The bot adheres to the Openai Format Schema. Please adapt using gateway or one-api independently.

Demo Vision With Voice Code Interpreter
sticker vision code

🔨 Roadmap

The program has iterated to its fourth generation.

  • Removal of legacy code
  • Deletion of metric system
  • Deletion of model selection system, unified to OpenAI Schema
  • Implementation of a more robust plugin system
  • Project structure simplification
  • Elimination of the Provider system
  • Hook support
  • Access to TTS
  • Add standalone support for gpt-4-turbo and vision
  • Add LLM reference support to the plugin environment. (extract && search in text)

📦 Features

  • 🍪 A comprehensive plugin development ecosystem, adopting a classic design, and seamless integration with plugins through pip installation
  • 📝 Message system with no time or sender constraints, offering fully decoupled logics
  • 📬 Offers Login via a URL mechanism, providing a flexible and expandable authentication development solution
  • 🍰 Empowers users to authorize plugin execution. Users can configure plugin environment variables at their discretion
  • 📦 Support for plugins to access files
  • 🍟 Multi-platform support – extend new platforms by inheriting the base class
  • 🍔 Plugins can determine their appearance in new sessions dynamically, preventing performance degradation despite large amounts of plugins

🍔 Login Modes

  • Login via url: Use /login <a token>$<something like https://provider.com/login> to Login. The program posts the token to the interface to retrieve configuration information, how to develop this.
  • Login: Use /login https://<api endpoint>/v1$<api key>$<the model>$<tool model such as gpt-3.5-turbo> to login

🧀 Plugin Can Do More

Sticker Converter Timer Function(built-in)
sticker timer

🎬 Platform Support

Platform Support File System Remarks
Telegram
Discord
Kook Does not support triggering by reply
Slack Does not support triggering by reply
Line
QQ
Wechat
Twitter
Matrix
IRC
... Create Issue/PR

📦 Quick Start

Refer to the 🧀 Deployment Document for more information.

📦 One-click Deployment

If you are using a brand-new server, you can use the following shell to automatically install this project.

curl -sSL https://raw.githubusercontent.com/LLMKira/Openaibot/main/deploy.sh | bash

📦 Manual Installation

# Install Voice dependencies
apt install ffmpeg
# Install RabbitMQ
docker pull rabbitmq:3.10-management
docker run -d -p 5672:5672 -p 15672:15672 \
  -e RABBITMQ_DEFAULT_USER=admin \
  -e RABBITMQ_DEFAULT_PASS=8a8a8a \
  --hostname myRabbit \
  --name rabbitmq \
  rabbitmq:3.10-management
docker ps -l
# Install Project
git clone https://github.com/LlmKira/Openaibot/
cd Openaibot
pip install pdm
pdm install -G bot
cp .env.exp .env && nano .env
# Test
pdm run python3 start_sender.py
pdm run python3 start_receiver.py
# Host
apt install npm
npm install pm2 -g
pm2 start pm2.json

Be sure to change the default password for the command, or disable open ports to prevent the database from being scanned and attacked.

🥣 Docker

Build Hub: sudoskys/llmbot

Note that if you run this project using Docker, you will start Redis, MongoDB, and RabbitMQ. But if you're running locally, just RabbitMQ

Manual Docker-compose Installation

git clone https://github.com/LlmKira/Openaibot.git
cd Openaibot
cp .env.exp .env&&nano .env
docker-compose -f docker-compose.yml up -d

The Docker configuration file docker-compose.yml contains all databases. In fact, Redis and MongoDB are not required. You can remove these databases yourself and use the local file system.

Update image using docker-compose pull.

Use docker exec -it llmbot /bin/bash to view Shell in Docker, enter exit to exit.

🍪 Slash Commands

clear - Deletes chat records
login - Login to the bot
help - Displays documentation
chat - Conversation
task - Use a function to converse
ask - Disable function-based conversations
tool - Lists all functions
auth - Authorize a function
env - Environment variables of the function
learn - Learn your instructions, /learn reset to clear

💻 How to Develop Plugins?

Refer to the example plugins in the plugins directory and the 🧀 Plugin Development Document for plugin development documentation.

Hooks

Hooks control the EventMessage in sender and receiver. For example, we have voice_hook in built-in hooks.

you can enable it by setting VOICE_REPLY_ME=true in .env.

/env VOICE_REPLY_ME=yes
# must

/env REECHO_VOICE_KEY=<key in dev.reecho.ai>
# not must

use /env VOICE_REPLY_ME=NONE to disable this env.

check the source code in llmkira/extra/voice_hook.py, learn to write your own hooks.

🧀 Sponsor

sponsor

📜 Notice

This project, named OpenAiBot, signifying "Open Artificial Intelligence Robot", is not officially affiliated with OpenAI.

FOSSA Status

openaibot's People

Contributors

chitang233 avatar chiyuki0325 avatar e-sion avatar fossabot avatar frostleafchan avatar huige233 avatar itxcjm avatar lianzizhou avatar purofle avatar sider2vf avatar sparanoid avatar sudoskys avatar wpv-chan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openaibot's Issues

[BUG] APIBOOM:completion length.

invalid_request_error:This model's maximum context length is 4097 tokens, however you requested 4113 tokens (1613 in your prompt; 2500 for the completion). Please reduce your prompt; or completion length.

prompt截取时仅有对话中第二个字

与机器人对话,发现输出的内容基本一致且无意义。观察控制台输出,发现prompt后为发送消息的第二个字。不论输入何种语言均为这样。
image

雲端Danger.form似乎無法正常下載

python main.py

初始化失败 -> https://raw.githubusercontent.com/fwwdn/sensitive-stop-words/master/%E6%94%BF%E6%B2%BB%E7%B1%BB.txt
初始化失败 -> https://raw.githubusercontent.com/TelechaBot/AntiSpam/main/Danger.txt
初始化 -> Danger.form
Traceback (most recent call last):
File "main.py", line 7, in
from App.Controller import BotRunner
File "/home/tk/文档/Openaibot-main/App/Controller.py", line 16, in
from App import Event
File "/home/tk/文档/Openaibot-main/App/Event.py", line 40, in
ContentDfa = DFA(path="./Data/Danger.form")
File "/home/tk/文档/Openaibot-main/utils/Detect.py", line 60, in init
self.get_words()
File "/home/tk/文档/Openaibot-main/utils/Detect.py", line 64, in get_words
with open(self.path, 'r', encoding='utf-8-sig') as f:
FileNotFoundError: [Errno 2] No such file or directory: './Data/Danger.form'

运行python出错

2022-12-16 17:47:27.297 | ERROR | App.Event:private_Chat:347 - You can't write against a read only replica.

在更新到最新版本后,多API管理出现了问题

使用 curl -LO https://raw.githubusercontent.com/sudoskys/Openaibot/main/setup.sh && sh setup.sh 执行更新并保留原配置后,再次启动机器人,已有的 API key 是正常的,但如果我执行 /add_api_key 以后,再使用 /see_api_key 查看 API key 列表,就会发现只剩下刚刚添加的 API key 了,查看 run.log 无报错,只有执行成功的日志,检查了 Openaibot\Config\api_keys.json ,也只有刚刚添加的 API key ,初步怀疑是 Event.py 的问题

[lib]兼容 openai-python

接口一致,所以可以很方便地混用,除了 chatGPT 方案官方不支持。

请注意依赖兼容性。

Error:'latin-1' codec can't encode characters in position 104-110: ordinal not in range(256)

完全按照README的操作来的

系统:Debian 11
架构:x86_64
python 3.9

启动添加 API KEY 和 白名单 正常
但是发送 /chat 后 log 报错

None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
Downloading: 100%|####################################################################| 1.04M/1.04M [00:00<00:00, 1.06MB/s]
Downloading: 100%|#######################################################################| 456k/456k [00:00<00:00, 594kB/s]
Downloading: 100%|####################################################################| 1.36M/1.36M [00:00<00:00, 1.43MB/s]
Downloading: 100%|#########################################################################| 665/665 [00:00<00:00, 638kB/s]
2022-12-14 11:06:05.318 | ERROR    | App.Event:load_response:180 - RUN:Api Error:'latin-1' codec can't encode characters in position 104-110: ordinal not in range(256)
Run time of job "BotRunner.run.<locals>.get_request_frequency (trigger: interval[0:00:04], next run at: 2022-12-14 11:05:47 EST)" was missed by 0:00:01.345064

[Bug]运行时区问题

IMG_20221218_085738.jpg
在debian11环境下我先使用 timedatectl 检测系统时区为Asia/Shanghai
但python3运行仍然报错
但我使用 export TZ='Asia/Shanghai'修改时区后再执行 python3 main.py成功运行
Screenshot_2022-12-18-08-56-40-687_com.server.auditor.ssh.client.jpg

chatGPT

后续会用真正的chatGPT替代语言推理 ,跟踪上下文

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.