feat: v3.6 重构 - 拆分 ai_cli.py 为模块化架构
本次更新由 mimo 自动化执行,与开发者无关。 新增 xiaoli/ 包: - __main__.py: 入口点 (python -m xiaoli) - app.py: 主应用薄编排层(~400行 vs 原3860行) - config.py: 配置管理 - engines.py: AI 引擎管理 - sandbox.py: 代码安全沙箱 - prompt.py: 系统提示词构建 - conversation/: 对话解析器 + 历史管理 - display/: CLI/TUI 双模式输出 改进: - 支持 argparse (--tui, --engine, --version) - 插件命令注册表 - 更新 README - 更新 .gitignore 原 ai_cli.py 保留向后兼容
This commit is contained in:
1 parent
95a0e4bc5c
commit
e1eee6a0c2
12 files changed
+1592
-65
No files matched your search
@@ -1,19 +1,133 @@
|
||||
# xiaoli cli
|
||||
# 小狸 Pro-CLI
|
||||
|
||||
#请前往下载压缩包获取开源代码
|
||||
智能编程助手 — 支持精准代码编辑、代码搜索、Git 版本控制、多 AI 引擎切换。
|
||||
|
||||
#### 介绍
|
||||
本仓库用于提交xiaoli系列源代码,本仓库源于github 2024年九月项目,因账户2fa码丢失,现已迁移至gitee
|
||||
## 快速开始
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
```bash
|
||||
# 安装依赖
|
||||
pip install colorama openai requests Pillow numpy
|
||||
|
||||
# 启动 CLI
|
||||
python -m xiaoli
|
||||
|
||||
#### 安装教程
|
||||
# 或指定引擎
|
||||
python -m xiaoli --engine mimo
|
||||
|
||||
1. 安装至少python 3.11以上版本
|
||||
1. 或点击发行版内启动器快速安装
|
||||
# 启动 TUI 模式(需要 textual)
|
||||
python -m xiaoli --tui
|
||||
```
|
||||
|
||||
#### 使用说明
|
||||
## 核心能力
|
||||
|
||||
1. 直接点击启动器启动
|
||||
### 代码编辑 (code_editor)
|
||||
```bash
|
||||
# 精准替换
|
||||
{"action":"use_tool","tool":"code_editor","args":"edit src/app.py
|
||||
def old():
|
||||
pass
|
||||
<<<>>>
|
||||
def new():
|
||||
return True"}
|
||||
|
||||
# 批量编辑
|
||||
{"action":"use_tool","tool":"code_editor","args":"multi src/app.py [{\"old\":\"old1\",\"new\":\"new1\"}]"}
|
||||
|
||||
# 查看代码
|
||||
{"action":"use_tool","tool":"code_editor","args":"read_range src/app.py 10 20"}
|
||||
```
|
||||
|
||||
### 代码搜索 (code_search)
|
||||
```bash
|
||||
# 项目结构
|
||||
{"action":"use_tool","tool":"code_search","args":"structure ."}
|
||||
|
||||
# 搜索代码
|
||||
{"action":"use_tool","tool":"code_search","args":"find . process *.py"}
|
||||
|
||||
# 符号提取
|
||||
{"action":"use_tool","tool":"code_search","args":"symbols ."}
|
||||
|
||||
# 代码统计
|
||||
{"action":"use_tool","tool":"code_search","args":"stats ."}
|
||||
```
|
||||
|
||||
### Git 操作 (git_tools)
|
||||
```bash
|
||||
{"action":"use_tool","tool":"git_tools","args":"status"}
|
||||
{"action":"use_tool","tool":"git_tools","args":"diff"}
|
||||
{"action":"use_tool","tool":"git_tools","args":"log --oneline 10"}
|
||||
{"action":"use_tool","tool":"git_tools","args":"commit 修复bug"}
|
||||
```
|
||||
|
||||
## 命令
|
||||
|
||||
| 命令 | 说明 |
|
||||
|------|------|
|
||||
| `/help` | 帮助信息 |
|
||||
| `/quit` | 退出 |
|
||||
| `/model <引擎>` | 切换 AI 引擎 |
|
||||
| `/engine list` | 列出可用引擎 |
|
||||
| `/chat save/list/open` | 聊天记录管理 |
|
||||
| `/file.read <路径>` | 读取文件 |
|
||||
| `/tui` | 切换 TUI 模式 |
|
||||
|
||||
## AI 引擎
|
||||
|
||||
| 引擎 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| ollama | 本地 | Ollama 本地模型 |
|
||||
| mimo | 云端 | 小米 MiMo |
|
||||
| glm_http | 云端 | 智谱 GLM |
|
||||
| qwq | 云端 | QwQ 深度思考 |
|
||||
| maas_http | 云端 | MaaS |
|
||||
|
||||
## 架构
|
||||
|
||||
```
|
||||
xiaoli/ # 新架构(v3.6)
|
||||
├── __init__.py # 版本信息
|
||||
├── __main__.py # 入口点 (python -m xiaoli)
|
||||
├── app.py # 主应用(薄编排层)
|
||||
├── config.py # 配置管理
|
||||
├── engines.py # AI 引擎管理
|
||||
├── sandbox.py # 代码安全沙箱
|
||||
├── prompt.py # 系统提示词
|
||||
├── conversation/ # 对话处理
|
||||
│ ├── __init__.py # 响应解析器
|
||||
│ └── history.py # 聊天记录
|
||||
└── display/ # 显示输出
|
||||
└── __init__.py # CLI/TUI 双模式
|
||||
|
||||
plugins/ # 插件(Liugin 协议)
|
||||
├── code_editor.py # 精准代码编辑器 ⭐
|
||||
├── code_search.py # 代码搜索理解 ⭐
|
||||
├── git_tools.py # Git 版本控制 ⭐
|
||||
├── file_manager.py # 文件管理
|
||||
├── ai_search.py # AI 搜索
|
||||
├── cmd_executor.py # 命令执行
|
||||
└── ...
|
||||
|
||||
ai_engines/ # AI 引擎
|
||||
├── ollama_engine.py
|
||||
├── mimo_engine.py
|
||||
├── GLM_http_engine.py
|
||||
└── ...
|
||||
```
|
||||
|
||||
## 开发
|
||||
|
||||
```bash
|
||||
# 克隆
|
||||
git clone https://gitee.com/shuiyu1123/xiaoli-cli.git
|
||||
|
||||
# 安装依赖
|
||||
pip install -r requirements.txt
|
||||
|
||||
# 运行
|
||||
python -m xiaoli
|
||||
```
|
||||
|
||||
## 许可证
|
||||
|
||||
MIT License
|
||||
Reference in new issue
Block a user