Skip to main content

A high-performance, highly scalable QQ group and private chat robot based on a self-developed architecture.

Project description

Undefined

A high-performance, highly scalable QQ group and private chat robot based on a self-developed architecture.

Python License

大鹏一日同风起,扶摇直上九万里。

项目简介

Undefined 是一个功能强大的 QQ 机器人平台,采用全新的 自研 Skills 架构。基于现代 Python 异步技术栈构建,它不仅提供基础的对话能力,更通过内置的多个智能 Agent 实现了代码分析、网络搜索、娱乐互动等多模态综合能力。

Undefined

NagaAgent 进行联动!

立即体验

点击添加官方实例QQ

核心特性

  • Skills 架构:全新设计的技能系统,将基础工具(Tools)与智能代理(Agents)分层管理,支持自动发现与注册。
  • 并行工具执行:无论是主 AI 还是子 Agent,均支持 asyncio 并发工具调用,大幅提升多任务处理速度(如同时读取多个文件或搜索多个关键词)。
  • 智能 Agent 矩阵:内置多个专业 Agent,分工协作处理复杂任务。
  • 思维链支持:支持开启思维链,提升复杂逻辑推理能力。
  • 高并发架构:基于 asyncio 全异步设计,支持多队列消息处理与工具并发执行,轻松应对高并发场景。
  • 安全防护:内置独立的安全模型,实时检测注入攻击与恶意内容。
  • OneBot 协议:完美兼容 OneBot V11 协议,支持多种前端实现(如 NapCat)。

安装与部署

方式一:使用 pip 安装(推荐)

如果您只是想使用机器人,推荐直接从 Release 下载安装包或通过 pip 安装。

1. 安装

直接通过 PyPI 安装:

pip install Undefined-bot

或者下载 Release 中的 .whl 文件运行:

pip install /path/to/Undefined_bot-x.x.x-py3-none-any.whl

还需要安装浏览器内核(如果尚未安装):

playwright install

2. 配置与运行

  1. 创建一个文件夹作为机器人的工作目录
  2. 克隆 NagaAgent 仓库./code/NagaAgent
  3. 在工作目录下创建一个 .env 文件,填入您的配置信息(参考下方配置说明或于 Github 中打开 .env.example 查看注释)。
  4. 在工作目录下打开终端,直接输入命令启动:
Undefined

注意:程序会自动读取当前运行目录下的 .env 文件作为配置。

方式二:源码部署(开发)

如果您想进行二次开发或调试,请使用此方式。

1. 克隆项目

由于项目中使用了 NagaAgent 作为子模块,请使用以下命令克隆项目:

git clone --recursive https://github.com/69gg/Undefined.git
cd Undefined

如果已经克隆了项目但没有初始化子模块:

git submodule update --init --recursive

2. 安装依赖

推荐使用 uv 进行依赖管理:

uv sync

3. 配置环境

复制所有的示例配置文件(.env.example -> .env)并填写你的配置信息。

cp .env.example .env

4. 启动运行

uv run -m Undefined

配置说明(通用)

无论使用哪种方式,都需要配置 .env 文件:

  • 基础配置BOT_QQ, SUPERADMIN_QQ, ONEBOT_WS_URL
  • 模型配置
    • CHAT_MODEL_*:主对话模型
    • VISION_MODEL_*:视觉识别模型
    • AGENT_MODEL_*:Agent 专用模型(建议使用能力更强的模型)
    • SECURITY_MODEL_*:安全审核模型
  • 功能配置LOG_LEVEL

启动项目需要 OneBot 实例,推荐使用 NapCat

使用说明

部署后的初始化

机器人启动后会自动连接到 OneBot 实例。如果连接成功,您会在日志中看到机器人 QQ 号及管理员信息。

Agent 能力展示

机器人通过自然语言自动调用相应的 Agent 完成任务:

1. 网络与信息

  • "搜索一下最近的 AI 新闻"
  • "看看今天的微博热搜"
  • "查询北京明天的天气"

2. 代码与开发

  • "分析一下当前项目的目录结构"
  • "读取 src/main.py 的内容并解释"
  • "在代码库中搜索 'AgentRegistry'"

3. 娱乐与社交

  • "搜一首周杰伦的歌"
  • "找一下 B 站关于 Python 的教程"
  • "画一只赛博朋克风格的猫"
  • "看一下今天的运势"

管理员命令

/help               # 查看帮助
/lsadmin            # 查看管理员列表
/addadmin <QQ>      # 添加管理员(仅超级管理员)
/rmadmin <QQ>       # 移除管理员(仅超级管理员)
/bugfix <QQ> <Time> # 生成 Bug 修复报告

消息优先级

系统采用多级优先队列设计:

  1. 最高:超级管理员私聊
  2. :普通私聊
  3. :群聊被 @
  4. :群聊普通消息

目录结构

src/Undefined/
├── skills/
│   ├── agents/    # 智能体集合 (Web, Code, Social...)
│   └── tools/     # 基础工具 (SendMsg, Render...)
├── config.py      # 配置管理
├── handlers.py    # 消息处理器
└── ai.py          # AI 核心逻辑

扩展与开发

Undefined 采用模块化的 Skills 架构,扩展非常简单:

  • 添加工具: 在 skills/tools/ 下新建目录,添加 config.jsonhandler.py
  • 添加 Agent: 在 skills/agents/ 下新建目录,定义 intro.mdprompt.md

致谢与友链

NagaAgent

本项目集成 NagaAgent 子模块。Undefined 诞生于 NagaAgent 社区,感谢作者及社区的支持。

NagaAgent - A simple yet powerful agent framework.

开源协议

本项目遵循 MIT License 开源协议。

⭐ 如果这个项目对您有帮助,请考虑给我们一个 Star

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

undefined_bot-2.2.2.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

undefined_bot-2.2.2-py3-none-any.whl (227.9 kB view details)

Uploaded Python 3

File details

Details for the file undefined_bot-2.2.2.tar.gz.

File metadata

  • Download URL: undefined_bot-2.2.2.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for undefined_bot-2.2.2.tar.gz
Algorithm Hash digest
SHA256 37c613df62e1fa390124c60bd6fe4efbfda60adc29382ee9971fba7e00ad19d8
MD5 f1cb5b59cff14ba445ea5e987ef85486
BLAKE2b-256 a2112f97ad88a73437533dcc99530b353a427058767f691329ffe3a5fdf624b8

See more details on using hashes here.

File details

Details for the file undefined_bot-2.2.2-py3-none-any.whl.

File metadata

  • Download URL: undefined_bot-2.2.2-py3-none-any.whl
  • Upload date:
  • Size: 227.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for undefined_bot-2.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 797af85d2ae8b14569a27cbcb22d1040a4ad0c6517e006329c51af2140fc2d4c
MD5 b94d3bdea820d24aae9f822ab041a2bc
BLAKE2b-256 30c210b24bab337d3cbd2c498023fbe60cf7c29e1e8e9fed4417f5c7dabe0ff3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page