Skip to main content

AI 智能助手系统 - 基于 Python 构建的全功能 AI 智能助手

Project description

🚀 Ridex — AI 智能助手系统

Ridex 是一个基于 Python 构建的全功能 AI 智能助手系统,拥有丰富的 TUI(终端用户界面)和强大的多代理协作架构。


✨ 项目概述

Ridex 不仅仅是一个 CLI 工具,它是一套完整的 AI 代理生态体系。通过与 DeepSeek API 深度集成,Ridex 能够:

  • 🤖 作为智能助手与用户进行自然对话
  • 🧩 动态创建和管理工具,扩展自身能力
  • 🔄 创建子代理来并行处理复杂任务
  • 📋 制定任务计划,有序执行多步骤流程
  • 🧠 积累和学习经验,持续优化服务质量
  • 🖥️ 执行终端命令,与环境交互

🏗️ 项目架构

Ridex/
├── 📁 configs/                    # 配置文件目录
│   ├── ridex.conf                 # 主配置文件(AI模型、日志、CLI等)
│   ├── tools.json                 # 工具注册表
│   └── experience_store.json      # 经验知识库
│
├── 📁 src/                        # 核心源代码
│   ├── 📁 cli/                    # 🖥️ TUI 终端界面层
│   │   ├── cli.py                 # CLI 主入口(987行)
│   │   ├── cursor.py              # 光标管理
│   │   ├── 📁 areas/              # 界面区域模块
│   │   │   ├── animation.py       # 🎬 动画系统(33KB)
│   │   │   ├── content.py         # 内容展示区
│   │   │   ├── messages.py        # 消息渲染区
│   │   │   ├── input_line.py      # 输入行区
│   │   │   ├── completion.py      # 自动补全区
│   │   │   ├── sub_agent_status.py# 子代理状态面板
│   │   │   └── border_renderer.py # 边框渲染器
│   │   └── 📁 utils/              # CLI 工具
│   │
│   ├── 📁 aitoolbox/              # 🧠 AI 核心工具箱
│   │   ├── builtin_tools.py       # 内置工具定义(40KB)
│   │   ├── config.py              # 系统配置与提示词
│   │   ├── 📁 core/               # 核心引擎
│   │   │   ├── 📁 agents/         # 🤖 代理系统
│   │   │   │   ├── master_agent.py # 主代理(协调器)
│   │   │   │   └── sub_agent.py    # 子代理(任务执行器)
│   │   │   ├── 📁 base/           # 基础组件
│   │   │   │   ├── base_agent.py  # 代理基类
│   │   │   │   ├── enums.py       # 枚举定义
│   │   │   │   ├── exceptions.py  # 自定义异常
│   │   │   │   ├── tool_decorator.py # 工具装饰器
│   │   │   │   └── tool_result.py # 工具结果封装
│   │   │   ├── 📁 config/         # 运行配置
│   │   │   └── 📁 services/       # 核心服务
│   │   ├── 📁 tools/              # 🛠️ 工具实现
│   │   │   ├── file_ops.py        # 文件操作工具
│   │   │   ├── web_search.py      # 联网搜索工具
│   │   │   └── get_weather.py     # 天气查询工具
│   │   └── 📁 utils/              # 工具箱工具
│   │       ├── experience_manager.py # 经验管理器
│   │       ├── terminal_command_runner.py # 终端命令运行器
│   │       └── sensitive_data_manager.py # 敏感数据管理器
│   │
│   ├── 📁 logger/                 # 日志系统
│   ├── 📁 utils/                  # 通用工具
│   ├── default_configs.py         # 默认配置加载
│   └── __init__.py                # 项目入口
│
├── 📁 tests/                      # 单元测试
│   ├── test_tool_decorator.py     # 工具装饰器测试
│   └── test_tool_result.py        # 工具结果测试
│
├── 📁 .venv/                      # Python 虚拟环境
├── requirements.txt               # 项目依赖
├── Ridex.cmd                      # Windows 启动脚本
├── run.bat                        # 备用启动脚本
├── clean.ps1                      # 缓存清理脚本
└── .gitignore                     # Git 忽略规则

🎯 核心功能

1. 🤖 多代理系统

组件 说明
主代理 (MasterAgent) 协调全局对话、工具调度、子代理管理
子代理 (SubAgent) 独立执行子任务,支持并行处理
任务计划 将复杂任务分解为有序执行计划

2. 🛠️ 动态工具系统

  • 支持运行时动态创建新工具
  • 内置工具:文件操作、联网搜索、天气查询
  • 工具参数自动校验与类型转换
  • 支持同步/异步/流式执行模式

3. 🧠 经验管理系统

  • 自动记录任务执行经验和最佳实践
  • 支持经验检索和分类浏览
  • 持续学习优化服务质量

4. 🖥️ 丰富的 TUI 界面

  • 🎬 实时动画系统:动态更新状态提示
  • 📝 智能输入补全:支持命令历史补全
  • 🔄 子代理状态面板:实时监控子任务进度
  • 🎨 彩色渲染:清晰的视觉分区

⚙️ 技术栈

技术 用途
Python 3.12+ 开发语言
DeepSeek API AI 模型服务
newrcc 终端彩色文本渲染
rich 富文本输出
aiohttp 异步 HTTP 请求
cryptography 数据加密
pytest 单元测试

🚀 快速开始

环境要求

  • Python 3.12+
  • Windows 系统(当前版本)

安装

# 克隆项目
git clone <your-repo-url>
cd Ridex

# 创建虚拟环境
python -m venv .venv

# 安装依赖
pip install -r requirements.txt

配置

编辑 configs/ridex.conf,配置 AI API 密钥:

[AI]
AI_API_KEY=your_api_key_here
BASE_URL=https://api.deepseek.com/v1
AI_MODEL=deepseek-v4-flash

启动

# 方式一:双击 Ridex.cmd
# 方式二:命令行运行
.\run.bat

📂 配置文件说明

文件 说明
configs/ridex.conf 主配置文件:AI模型、日志、CLI界面等
configs/tools.json 动态工具注册文件
configs/experience_store.json 经验知识库(请勿删除!)

🔮 未来规划

  • 支持更多 AI 模型提供商(OpenAI、Claude 等)
  • 插件系统扩展
  • Web 界面支持
  • 多用户/多会话管理
  • 更丰富的内置工具集
  • 跨平台支持(Linux/macOS)

📜 许可证

本项目仅供学习研究使用。


Ridex — 让 AI 成为你的得力助手 🤖✨

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

ridex-1.2.1.tar.gz (167.0 kB view details)

Uploaded Source

Built Distribution

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

ridex-1.2.1-py3-none-any.whl (194.0 kB view details)

Uploaded Python 3

File details

Details for the file ridex-1.2.1.tar.gz.

File metadata

  • Download URL: ridex-1.2.1.tar.gz
  • Upload date:
  • Size: 167.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for ridex-1.2.1.tar.gz
Algorithm Hash digest
SHA256 5fce9195b29f550c4c98991cb6e046ad075dab83cbef09ab6ed543ec3b0c1727
MD5 0f98dcae05c63af988c3770be3ce5c8d
BLAKE2b-256 73188e6496406967673a2b49827e4d1c43eef87e3850b100ecba6a6d1caed1a4

See more details on using hashes here.

File details

Details for the file ridex-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: ridex-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 194.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for ridex-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e7fe1e62043d8c38d90d5a9278fff4634f9c79c23c56d94d4b7cff960b9e10bf
MD5 0f80291db5b421237f6acfff73153e52
BLAKE2b-256 7ab506993be453a578d36cc363f1b4cc49d24eecaf5e7e7609d1af165637b38a

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