OneBot adapter for lss233/chatgpt-mirai-qq-bot
Project description
OneBot-adapter for ChatGPT-Mirai-QQ-Bot
本项目是 ChatGPT-Mirai-QQ-Bot 的一个插件,用于将OneBot协议的消息转换为ChatGPT-Mirai-QQ-Bot的消息格式。
安装
pip install chatgpt-mirai-qq-bot-onebot-adapter
使用
在 config.yaml 中的 ims 中添加以下内容:
ims:
enable:
onebot: ['onebot']
... # 其他IM配置
configs:
onebot:
host: '0.0.0.0' # OneBot服务器地址
port: '5545' # OneBot服务器端口
access_token: '' # OneBot服务器访问令牌
heartbeat_interval: '15' # 心跳间隔(秒)
... # 其他IM配置
项目工作原理
sequenceDiagram
participant Client as OneBot Client
participant Adapter as OneBotAdapter
participant Dispatcher as WorkflowDispatcher
participant Memory as MemorySystem
participant LLM as LLMService
Client->>Adapter: WebSocket消息
Note over Adapter: 心跳检测
alt 元事件
Adapter->>Adapter: _handle_meta
Note over Adapter: 更新连接状态
else 消息事件
Adapter->>Adapter: _handle_msg
Adapter->>Adapter: convert_to_message
Note over Adapter: 转换为IMMessage格式
Adapter->>Dispatcher: dispatch
alt 工作流匹配
Dispatcher->>Memory: 查询历史记录
Memory-->>Dispatcher: 返回对话历史
Dispatcher->>LLM: 请求响应
LLM-->>Dispatcher: 返回AI回复
Dispatcher-->>Adapter: 返回处理结果
Adapter->>Adapter: convert_to_message_segment
Note over Adapter: 转换为OneBot消息段
loop 每个消息段
Note over Adapter: 添加随机延时
alt 群消息
Adapter->>Client: send_group_msg
else 私聊消息
Adapter->>Client: send_private_msg
end
end
else 无匹配工作流
Note over Dispatcher: 跳过处理
end
end
Client-->>Adapter: 消息处理完成
开源协议
本项目基于 ChatGPT-Mirai-QQ-Bot 开发,遵循其 开源协议
感谢
感谢 ChatGPT-Mirai-QQ-Bot 的作者 lss233 提供框架支持
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chatgpt_mirai_qq_bot_onebot_adapter-0.1.4.tar.gz.
File metadata
- Download URL: chatgpt_mirai_qq_bot_onebot_adapter-0.1.4.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
757950e18cf5eb51bf98db0f3abb9df7ad044e96a644eae0c2ae5b4e07aa0da5
|
|
| MD5 |
30bf0d0173a35ba875e8ed5d2ed62856
|
|
| BLAKE2b-256 |
fc27b885799d95ee6504ec976b22960a955e4f705f2190fbb83bf7d389ad1e28
|
Provenance
The following attestation bundles were made for chatgpt_mirai_qq_bot_onebot_adapter-0.1.4.tar.gz:
Publisher:
publish.yml on Cloxl/chatgpt-mirai-qq-bot-onebot-adapter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chatgpt_mirai_qq_bot_onebot_adapter-0.1.4.tar.gz -
Subject digest:
757950e18cf5eb51bf98db0f3abb9df7ad044e96a644eae0c2ae5b4e07aa0da5 - Sigstore transparency entry: 168944969
- Sigstore integration time:
-
Permalink:
Cloxl/chatgpt-mirai-qq-bot-onebot-adapter@4f3d2994910160fe321aa2e474f18738e11ca3a1 -
Branch / Tag:
refs/tags/0.1.4 - Owner: https://github.com/Cloxl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4f3d2994910160fe321aa2e474f18738e11ca3a1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file chatgpt_mirai_qq_bot_onebot_adapter-0.1.4-py3-none-any.whl.
File metadata
- Download URL: chatgpt_mirai_qq_bot_onebot_adapter-0.1.4-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1932d9aa3a944eeb95bb3138843cca220ff25b949c59f759358c662e54b0aa4a
|
|
| MD5 |
90a8b38c9f85325436159112fb1f8fe3
|
|
| BLAKE2b-256 |
71ac3131b36a4365fc066debc6f4ef769c0bb61d6f8c31e97ee5fb6667f32ca5
|
Provenance
The following attestation bundles were made for chatgpt_mirai_qq_bot_onebot_adapter-0.1.4-py3-none-any.whl:
Publisher:
publish.yml on Cloxl/chatgpt-mirai-qq-bot-onebot-adapter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chatgpt_mirai_qq_bot_onebot_adapter-0.1.4-py3-none-any.whl -
Subject digest:
1932d9aa3a944eeb95bb3138843cca220ff25b949c59f759358c662e54b0aa4a - Sigstore transparency entry: 168944972
- Sigstore integration time:
-
Permalink:
Cloxl/chatgpt-mirai-qq-bot-onebot-adapter@4f3d2994910160fe321aa2e474f18738e11ca3a1 -
Branch / Tag:
refs/tags/0.1.4 - Owner: https://github.com/Cloxl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4f3d2994910160fe321aa2e474f18738e11ca3a1 -
Trigger Event:
release
-
Statement type: