Metadata-Version: 2.4
Name: kirara-ai
Version: 3.3.0a1
Summary: A framework for building AI agents
Author-email: Lss233 <i@lss233.com>
License-Expression: AGPL-3.0-only
Project-URL: Homepage, https://github.com/lss233/chatgpt-mirai-qq-bot
Project-URL: Bug Tracker, https://github.com/lss233/chatgpt-mirai-qq-bot/issues
Project-URL: Documentation, https://kirara-docs.app.lss233.com
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pydantic-core>=2.27.2
Requires-Dist: ruamel.yaml
Requires-Dist: pytest
Requires-Dist: pytest-asyncio
Requires-Dist: python-telegram-bot
Requires-Dist: telegramify-markdown
Requires-Dist: loguru
Requires-Dist: aiohttp
Requires-Dist: requests
Requires-Dist: quart>=0.18.4
Requires-Dist: quart-cors>=0.7.0
Requires-Dist: fastapi>=0.110.0
Requires-Dist: wechatpy
Requires-Dist: pycryptodome
Requires-Dist: redis[hiredis]
Requires-Dist: bcrypt>=4.0.1
Requires-Dist: PyJWT>=2.8.0
Requires-Dist: hypercorn>=0.15.0
Requires-Dist: psutil>=5.9.0
Requires-Dist: setuptools
Requires-Dist: tomli>=2.0.0
Requires-Dist: pre-commit
Requires-Dist: curl_cffi
Requires-Dist: python-magic; platform_system != "Windows"
Requires-Dist: python-magic-bin; platform_system == "Windows"
Requires-Dist: ymbotpy
Requires-Dist: Pillow
Requires-Dist: pytz
Requires-Dist: sqlalchemy
Requires-Dist: alembic
Requires-Dist: mcp
Dynamic: license-file


<p align="center">
  <h2 align="center">Kirara AI</h2>
  <p align="center">
    一款支持主流大语言模型、主流聊天平台的聊天的机器人！
    <br/>
    <br/>
    <a href="https://kirara-docs.app.lss233.com/"><strong>» 查看项目手册 »</strong></a>
    <br/>
  </p>
</p>

<p align="center">
  <a href="https://github.com/lss233/kirara-ai/stargazers"><img src="https://img.shields.io/github/stars/lss233/kirara-ai?color=F8B195&amp;logo=github&amp;style=for-the-badge" alt="Github stars"></a>
  <a href="https://pypi.org/project/kirara-ai/"><img src="https://img.shields.io/pypi/v/kirara-ai?color=F67280&amp;logo=pypi&amp;logoColor=white&amp;style=for-the-badge" alt="PyPI"></a>
  <a href="./LICENSE"><img src="https://img.shields.io/github/license/lss233/kirara-ai?&amp;color=C06C84&amp;style=for-the-badge" alt="License"></a>
</p>

<p align="center">
  <a href="https://github.com/lss233/kirara-ai/actions/workflows/docker-latest.yml"><img src="https://img.shields.io/github/actions/workflow/status/lss233/kirara-ai/docker-latest.yml?color=6C5B7B&amp;logo=docker&amp;logoColor=white&amp;style=for-the-badge" alt="Docker build latest"></a>
  <a href="https://hub.docker.com/r/lss233/kirara-ai/"><img src="https://img.shields.io/docker/pulls/lss233/kirara-agent-framework?color=355C7D&amp;logo=docker&amp;logoColor=white&amp;style=for-the-badge" alt="Docker Pulls"></a>
  <a href="https://codecov.io/gh/lss233/kirara-ai"><img alt="Codecov" src="https://img.shields.io/codecov/c/gh/lss233/kirara-ai?color=A8E6CE&amp;logo=codecov&amp;logoColor=white&amp;style=for-the-badge"></a>
  <img alt="Mypy checked" src="https://img.shields.io/badge/Mypy-checked-DCEDC2?style=for-the-badge&amp;logo=python&amp;logoColor=white">
</p>

*** 

![cover](https://raw.githubusercontent.com/Haibersut/cnblog/refs/heads/main/230783378-34ddb86a-c8d3-47a6-baa5-86e39200b258.jpg)

*** 

## 🌟 社区交流

加入我们的社区，获取最新项目动态、视频教程、问题答疑和技术交流！

* QQ 交流群:
  * [二群](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=S1R4eIlODtyKZsEKfWxb2-nOIHELbeJY&authKey=kAftCAALE8OJgwQnArrD6zPtncCAaY456QgUXT3l2OMJ57NwRXRkhv4KL7DzOLzs&noverify=0&group_code=373254418)（已满）
  * [三群](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=urlhCH8y7Ro2S-iXt63X4s5eILUny4Iw&authKey=ejiwoNa4Yez6IMLyf2vj%2FeRiC1frdFrNNekbRfaPnSQbcD7bgebo5y5A7rPaRKBq&noverify=0&group_code=533109074)（已满）
  * [四群](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Ibiu6EmXof30Fa7MJ5j8nJFwaUGTf5bM&authKey=YKx5a%2BK5qnWkk5VlsxxDfYl0nCrKSekQm%2FoLQVqr%2FcO%2FQY2S6N24XdI23XugBrF0&noverify=0&group_code=799737883)（已满）
  * [五群](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=lDkVPDAeiz6M-ig9cdS9tqhSH6_topox&authKey=B%2FRPYVUjk3dYPw5D4o6C2TpqeoKTG0nXEiKDCG%2Bh4JYY2RPqDQGt37SGl32j0hHw&noverify=0&group_code=805081636)
  * [六群](https://qm.qq.com/q/UpvYm3jccg)


> **提问前请先查看**: 加入群组前，请先查看[项目问题列表](https://github.com/lss233/kirara-ai/issues)，看是否能解决你的问题。
> 
> 如需提问，请准备好问题描述、**完整日志**和相关配置文件，以便我们更好地帮助你。  
> 进群请备注：GitHub

* [机器人调试群](https://jq.qq.com/?_wv=1027&k=TBX8Saq7) - 这里有多个 QQ 机器人供体验，不解答技术问题。
* [开发者交流群](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=lisyXibhUj93DgIZptQu3VZ4ka3F5-rW&authKey=PBCzRQX4Zei%2BB6n5Tdyp9p5bqcF0tLBlfGANT4dSSKQIFYR66WwaZSMEDahWo%2FzZ&noverify=0&group_code=701933732) - 欢迎参与 Kirara AI 及生态开发 / 对大模型应用有兴趣的开发者加入，一起交流学习。

## 📷 功能展示

| ![猫娘问答](https://img.shields.io/badge/-%E7%8C%AB%E5%A8%98%E9%97%AE%E7%AD%94-FF6B6B?style=for-the-badge&logo=github&logoColor=white) | ![智能助手](https://img.shields.io/badge/-智能助手-4ECDC4?style=for-the-badge&logo=wechat&logoColor=white) | ![沉浸式RPG](https://img.shields.io/badge/-沉浸式RPG-FFA07A?style=for-the-badge&logo=discord&logoColor=white) |
|:-------------------------------:|:-------------------------------:|:-------------------------------:|
| ![猫娘模式](https://user-images.githubusercontent.com/8984680/230702158-73967aa9-01be-44d6-bbd9-24437e333140.png) | ![日常助手](https://user-images.githubusercontent.com/8984680/230702177-de96f89b-053e-4313-a131-715af969db04.png) | ![文字冒险](https://user-images.githubusercontent.com/8984680/230702635-fb1de3bf-acbd-46ca-8d6f-caa47368b4d4.png) |

## 🧭 WebUI  

<div align="center">  

<h3 align="center">模型管理</h3>  

![image](https://github.com/user-attachments/assets/0839bff6-47d4-4fe2-a326-056185ef1ad4)


<h3 align="center">工作流</h3>  

![image](https://github.com/user-attachments/assets/c8ded878-3cf9-4c70-925d-ee29027674ff)

<h3 align="center">插件市场</h3>  

![image](https://github.com/user-attachments/assets/d734be88-e8f6-4b95-aba8-02a544ab7a9f)

</div>

## ⚡ 核心特性
* [x] 图片发送
* [x] 关键词触发回复
* [x] 多账号支持
* [x] 人格设定
* [x] 支持 QQ、Telegram、Discord、微信  
* [x] 可作为 HTTP 服务端提供 Web API
* [x] 支持 OpenAI、DeepSeek、Claude、Gemini、Qwen、Mistral、豆包、Minimax、Kimi、Mistral 等主流大模型
* [x] 支持插件机制
* [x] 支持条件触发
* [x] 支持管理员指令
* [x] 支持 Stable Diffusion、Flux、Midjourney 等绘图模型
* [x] 支持语音回复
* [x] 支持多轮对话
* [x] 支持跨平台消息发送
* [x] 支持自定义工作流
* [x] 支持 Web 管理后台
* [x] 内置 Frpc 内网穿透

# **🤖 聊天平台**  

我们支持多种聊天平台。  

| 平台       | 群聊回复 | 私聊回复 | 条件触发 | 管理员指令 | 绘图  | 语音回复 |
|----------|------|------|------|-------|-----|------|
| Telegram | 支持   | 支持   | 支持 | 支持  | 支持  | 支持   |
| QQ 机器人 | 支持   | 支持   | 支持 | 支持  | 支持  | 平台不支持   |
| Discord  | 重构中   | 重构中   | 重构中 | 重构中  | 重构中  | 重构中   |
| 飞书机器人  | 重构中   | 重构中   | 重构中 | 重构中  | 重构中  | 重构中   |
| 企业微信应用 | 支持   | 支持   | 支持 | 不支持  | 支持  | 支持   |
| 微信公众号 | 支持   | 支持   | 支持 | 不支持  | 支持  | 支持   |
| OneBot   | 插件支持   | 插件支持   | 插件支持   | 插件支持    | 插件支持  | 插件支持   |

## 🐎 命令

**你可以在 WebUI 的调度规则中自定义所有命令。**  


## 🔧 搭建

请移步至 [快速开始](https://kirara-docs.app.lss233.com/guide/getting-started.html)

## 🕸 HTTP API

<details>
    <summary>HTTP API 可用于接入其他平台。</summary>
在聊天平台管理中启动 http-legacy 适配器后，将提供以下接口：  

**POST**    `/v1/chat`  

**请求参数**  

|参数名|必选|类型|说明|
|:---|:---|:---|:---|
|session_id| 是 | String |会话ID，默认：`friend-default_session`|
|username| 是 | String |用户名，默认：`某人`|
|message| 是 | String |消息，不能为空|  

**请求示例**
```json
{
    "session_id": "friend-123456",
    "username": "testuser",
    "message": "ping"
}
```
**响应格式**
|参数名|类型|说明|
|:---|:---|:---|
|result| String |SUCESS,DONE,FAILED|
|message| String[] |文本返回，支持多段返回|
|voice| String[] |音频返回，支持多个音频的base64编码；参考：data:audio/mpeg;base64,...|
|image| String[] |图片返回，支持多个图片的base64编码；参考：data:image/png;base64,...|

**响应示例**  
```json
{
    "result": "DONE",
    "message": ["pong!"],
    "voice": [],
    "image": []
}
```

**POST**    `/v2/chat`  

**请求参数**  

|参数名|必选|类型|说明|
|:---|:---|:---|:---|
|session_id| 是 | String |会话ID，默认：`friend-default_session`|
|username| 是 | String |用户名，默认：`某人`|
|message| 是 | String |消息，不能为空|  

**请求示例**
```json
{
    "session_id": "friend-123456",
    "username": "testuser",
    "message": "ping"
}
```
**响应格式**
字符串：request_id

**响应示例**  
```
1681525479905
```

**GET**    `/v2/chat/response`  

**请求参数**  

|参数名|必选|类型|说明|
|:---|:---|:---|:---|
|request_id| 是 | String |请求id，/v2/chat返回的值|

**请求示例**
```
/v2/chat/response?request_id=1681525479905
```
**响应格式**
|参数名|类型|说明|
|:---|:---|:---|
|result| String |SUCESS,DONE,FAILED|
|message| String[] |文本返回，支持多段返回|
|voice| String[] |音频返回，支持多个音频的base64编码；参考：data:audio/mpeg;base64,...|
|image| String[] |图片返回，支持多个图片的base64编码；参考：data:image/png;base64,...|

* 每次请求返回增量并清空。DONE、FAILED之后没有更多返回。

**响应示例**  
```json
{
    "result": "DONE",
    "message": ["pong!"],
    "voice": ["data:audio/mpeg;base64,..."],
    "image": ["data:image/png;base64,...", "data:image/png;base64,..."]
}
```
</details>

## 🦊 加载预设

如果你想让机器人自动带上某种聊天风格，可以使用预设功能。  

我们自带了 `猫娘` 和 `正常` 两种预设，你可以在 `presets` 文件夹下了解预设的写法。  

使用 `加载预设 猫娘` 来加载猫娘预设。

下面是一些预设的小视频，你可以看看效果：
* MOSS： https://www.bilibili.com/video/av309604568
* 丁真：https://www.bilibili.com/video/av267013053
* 小黑子：https://www.bilibili.com/video/av309604568
* 高启强：https://www.bilibili.com/video/av779555493

关于预设系统的详细教程：[Wiki](https://github.com/lss233/kirara-ai/wiki/%F0%9F%90%B1-%E9%A2%84%E8%AE%BE%E7%B3%BB%E7%BB%9F)

你可以在 [Awesome ChatGPT QQ Presets](https://github.com/lss233/awesome-chatgpt-qq-presets/tree/master) 获取由大家分享的预设。

你也可以参考 [Awesome-ChatGPT-prompts-ZH_CN](https://github.com/L1Xu4n/Awesome-ChatGPT-prompts-ZH_CN) 来调教你的 ChatGPT，还可以参考 [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts) 来解锁更多技能。 

## 🎙 文字转语音

自 v2.2.5 开始，我们支持接入微软的 Azure 引擎 和 VITS 引擎，让你的机器人发送语音。

**提示**：在 Windows 平台上使用语音功能需要安装最新的 VC 运行库，你可以在[这里](https://learn.microsoft.com/zh-CN/cpp/windows/latest-supported-vc-redist?view=msvc-170)下载。`

## 🛠 贡献者名单   

欢迎提出新的点子、 Pull Request。  

<a href="https://github.com/lss233/kirara-ai/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=lss233/kirara-ai" />
</a>

Made with [contrib.rocks](https://contrib.rocks).

## 📕 相关项目

- [Kirara Registry](https://github.com/DarkSkyTeam/kirara-registry) - Kirara AI 插件市场
- [Kirara WebUI](https://github.com/DarkSkyTeam/kirara-webui) - Kirara AI 的 WebUI 前端项目
- [Kirara Docs](https://github.com/DarkSkyTeam/kirara-docs) - Kirara AI 的使用手册原始文档

## 💪 支持我们

如果我们这个项目对你有所帮助，请给我们一颗 ⭐️  

[![Star History Chart](https://api.star-history.com/svg?repos=lss233/kirara-ai&type=Date)](https://www.star-history.com/#lss233/kirara-ai&Date)
