QQ ChatBot with ChatGPT api, implement in Rust

Overview

qbot

QQChatBot with ChatGPT gpt-3.5-turbo api

Rust 实现,抽象了 cqhttp 的收发消息 msg、openai ai 的消息对象,具有一定管理权限、预设机器人角色、机器人指令等功能。

原理上是接受 cqhttp 的 local websocket 消息,处理其中的消息,构造出调用 openai api 的调用,得到返回结果后发送回答。

支持通过socks代理调用openai的api,主要方便直接在国内的服务器上挂QQ bot

欢迎 点 Star , Fork 二次修改 ,提 Issues,提 PR ~

注:不负责任何关于 openai key 和 proxy 的问题。

如何使用

  1. 下载 cqhttp
  2. 下载 qbot
  3. 开启 cqhttp (使用 2 local websocket,更多的还是看cqhttp官方吧)
  4. 开启 qbot,生成配置文件 ./qbot
  5. 编辑配置文件 config.json ,再次开启 qbot : nohup ./qbot &

配置文件

{
    "websocket": "ws://localhost:8080/ws",
    "proxy": "",
    "api_key": "sk-xxx",
    "bot_qq": 123,
    "root_qq": 456
}

功能

目前支持:

  • 单条消息回复群聊里的 @ 问题, 连续上下文记录
  • 私聊消息,连续上下文记录
  • # 机器人指令,更换prompt内容、清理上下文记录等。
  • #sudo 机器人指令,黑名单,强制清理上下文记录等。
  • 计算语句tokon usage,并自动清理

参考文档

LICENSE

MIT, 开源,feel free 拿去随便造。但是能留下个Star或者 fork 就更好了~

You might also like...
Simple Rust 🦀 api with Rocket 🚀

Car API Written in Rust & Rocket.rs 🦀 🚀 Running project Running by cargo You just need to run the following command: cargo run Running on docker Fi

Rust wrapper for the LeapC Ultraleap (Leap Motion) hand tracking device API.

LeapRS LeapRS is a safe wrapper for LeapC, the Leap Motion C API. It uses the generated binding provided by leap-sys. This is an API for accessing Lea

🔥Implemetación de una API REST basada en microservicios con Rust
🔥Implemetación de una API REST basada en microservicios con Rust

Microservicios 🚀 Breve Descripción Bienvenido a todos, aquí aprenderás a programar una API REST desde cero enfocada a la aquitectura de microservicio

Interact with the crate's API

cargo-crate-api Interact with the crate's API Documentation Installation Getting Started Reference FAQ Contribute CHANGELOG Install Download a pre-bui

A asynchronous implementation of the invidious innertube aka youtubei API wrapper

A asynchronous implementation of the invidious innertube aka youtubei API wrapper. Using tokio,reqwest, serde and serde_json

API for the creation character based games in Linux.
API for the creation character based games in Linux.

Console Game Engine for Linux. API for the creation of character based games in Linux. The inspiration came from the olcConsoleGameEngine. This is my

API and logger for GBFS endpoints, noticeably Velib' in Paris

GBFS Watcher A daemon which logs Velib' stations statuses and provides a REST endpoint to access data. Velib' API is built over GBFS v1, so this API c

The utility is designed to check the availability of peers and automatically update them in the Yggdrasil configuration file, as well as using the admin API - addPeer method.

Yggrasil network peers checker / updater The utility is designed to check the availability of peers and automatically update them in the Yggdrasil con

`memory_pages` is a small library provinig a cross-platform API to request pages from kernel with certain premisions

memory_pages: High level API for low level memory management While using low-level memory management in a project can provide substantial benefits, it

Releases(v0.2.0)
Owner
Eucalypt
Everything Everywhere All At Once.
Eucalypt
Shows how to implement USB device on RP2040 in Rust, in a single file, with no hidden parts.

Rust RP2040 USB Device Example This is a worked example of implementing a USB device on the RP2040 microcontroller, in Rust. It is designed to be easy

Cliff L. Biffle 9 Dec 7, 2022
List public items (public API) of Rust library crates. Enables diffing public API between releases.

cargo wrapper for this library You probably want the cargo wrapper to this library. See https://github.com/Enselic/cargo-public-items. public_items Li

Martin Nordholts 20 Dec 26, 2022
Uma lib para a API do Brasil API (para o Rust)

Uma lib para a API do BrasilAPI (para o Rust) Features CEP (Zip code) DDD Bank CNPJ IBGE Feriados Nacionais Tabela FIPE ISBN Registros de domínios br

Pedro Augusto 6 Dec 13, 2022
Rust library for hardware accelerated drawing of 2D shapes, images, and text, with an easy to use API.

Speedy2D Hardware-accelerated drawing of shapes, images, and text, with an easy to use API. Speedy2D aims to be: The simplest Rust API for creating a

null 223 Dec 26, 2022
An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous and blocking clients respectively.

eithers_rust An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous a

null 2 Oct 24, 2021
Code to follow along the "Zero To Production" book on API development in Rust.

Zero To Production / Code (Chapter 10 - Part 1) Zero To Production In Rust is an opinionated introduction to backend development using Rust. This repo

Luca Palmieri 2.8k Dec 31, 2022
Conversion Tools API Rust client

ConversionTools Rust This Conversion Tools API Rust client allows you to use the site API and convert files faster and more conveniently. Site Convers

WinsomeQuill 2 Jan 23, 2022
Public aircraft & flightroute api Built in Rust for Docker, using PostgreSQL & Redis

api.adsbdb.com public aircraft & flightroute api Built in Rust for Docker, using PostgreSQL & Redis See typescript branch for original typescript vers

Jack Wills 66 Dec 22, 2022
Simple RESTful API in rust created with actix-web. (Routing, models, JWT auth).

rust-simple-api Simple RESTful API created with rust, actix-web, Diesel, JWT. Running application Manual Firstly generate a secret.key which will be u

null 2 Jul 30, 2022
The second Rust implementation on GitHub of third-party REST API client for Bilibili.

Bilibili REST API The second Rust implementation on GitHub of third-party REST API client for Bilibili. Designed to be lightweight and efficient. It's

null 4 Aug 25, 2022