Metadata-Version: 2.4
Name: lightpilot-ai
Version: 0.2.0
Summary: 轻量级 AI Agent 框架 — 多平台、Web Dashboard、记忆系统、技能引擎
Author: Jun Wu
License-Expression: MIT
Keywords: ai-agent,llm,chatbot,feishu,agent-framework
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.100
Requires-Dist: uvicorn[standard]>=0.20
Requires-Dist: pyyaml>=6.0
Requires-Dist: httpx>=0.24
Requires-Dist: pydantic>=2.0
Requires-Dist: chromadb>=0.4
Requires-Dist: aiohttp>=3.9
Requires-Dist: websockets>=12.0
Provides-Extra: rich
Requires-Dist: rich>=13.0; extra == "rich"
Provides-Extra: feishu
Requires-Dist: lark-oapi>=1.6; extra == "feishu"
Requires-Dist: websockets>=12.0; extra == "feishu"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: ruff>=0.3; extra == "dev"
Provides-Extra: all
Requires-Dist: lightpilot[feishu,rich]; extra == "all"

# lightPilot

**轻量级 AI Agent 框架** — 多平台适配、Web Dashboard、记忆系统、技能引擎。

[![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)](https://www.python.org/)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
[![PyPI](https://img.shields.io/pypi/v/lightpilot-ai.svg)](https://pypi.org/project/lightpilot-ai/)

---

## 简介

lightPilot 是一个方法论驱动的 AI Agent 框架。兼容所有 OpenAI 协议的模型（DeepSeek、OpenAI、Moonshot、ZhipuAI、通义千问、Ollama 等），提供飞书/QQ/企业微信多平台适配、Web Dashboard、持久记忆、技能系统和上下文管理。

```
用户消息 → 理解确认 → 任务规划 → 逐步执行 → 结果验证 → 回复
```

---

## 安装

### 方式一：pip 安装（推荐）

```bash
# 国内用户使用清华镜像（更快）
pip install lightpilot-ai -i https://pypi.tuna.tsinghua.edu.cn/simple

# 或默认 PyPI
pip install lightpilot-ai
```

### 方式二：从源码安装

```bash
git clone http://192.168.3.70:8418/wujun2081/lightPilot.git
cd lightPilot
pip install -e .
```

### 可选依赖

```bash
# Rich 美化终端（强烈推荐）
pip install lightpilot-ai[rich]

# 飞书适配器
pip install lightpilot-ai[feishu]

# 全部
pip install lightpilot-ai[all] -i https://pypi.tuna.tsinghua.edu.cn/simple
```

---

## 快速开始

### 三步跑起来

```bash
# 1. 安装
pip install lightpilot-ai -i https://pypi.tuna.tsinghua.edu.cn/simple

# 2. 运行 → 看到引导页
lightpilot

# 3. 按引导操作
#   → 去任一平台（DeepSeek/OpenAI/Moonshot 等）拿 API Key
#   → lightpilot setup 配置
#   → lightpilot serve 启动

# 浏览器打开 http://localhost:9741
# 默认账号: admin  密码: lightpilot
```

### 命令行

| 命令 | 说明 |
|------|------|
| `lightpilot` | 显示引导 / 状态 |
| `lightpilot setup` | 交互式配置 API Key |
| `lightpilot serve` | 启动 Web Dashboard + API 服务 |
| `lightpilot chat` | 终端对话 |
| `lightpilot config` | 查看当前配置 |
| `lightpilot init` | 在当前目录生成 AGENTS.md 项目导航 |
| `lightpilot --help` | 完整帮助 |

### 支持的模型平台

lightPilot 兼容所有 **OpenAI 协议**的模型服务：

| 平台 | 地址 | 特点 |
|------|------|------|
| DeepSeek | platform.deepseek.com | 国内直连 · 性价比高 |
| OpenAI | platform.openai.com | GPT 系列 |
| Moonshot（月之暗面） | platform.moonshot.cn | 国内直连 |
| ZhipuAI（智谱） | open.bigmodel.cn | GLM 系列 · 国内直连 |
| 通义千问（阿里云） | dashscope.aliyun.com | 国内直连 |
| Ollama | localhost:11434 | 本地部署 |
| 自定义 | 任意 OpenAI-compatible API | 自建 / 代理 / 其他 |

配置时只需四样：

```
provider:  服务商标识（任意字符串，如 openai / deepseek / my-llm）
model:     模型名称（如 deepseek-v4-pro / gpt-4o）
base_url:  API 地址（如 https://api.deepseek.com/v1）
api_key:   你的 API Key
```

---

## 功能

### 🧠 核心引擎

- **理解确认门禁** — 破坏性操作自动拦截确认
- **任务规划** — 复杂任务自动拆解为可执行步骤
- **逐步执行** — 每步执行后验证
- **结果验证** — 自动检查执行结果

### 💾 记忆系统

- SQLite 持久记忆 + ChromaDB 向量检索
- 自动去重、合并、过期清理
- 用户画像自动更新

### 🔧 工具系统

- 声明式 Schema 注册
- 并行分发 + 自动重试
- 内置工具：文件读写、搜索、终端、网络搜索

### 🧩 技能引擎

- Markdown 格式的技能定义（SKILL.md）
- 按关键词自动激活
- 工具、脚本、模板绑定

### 🌐 平台适配

- **飞书** — WebSocket 实时消息 + OAuth 设备授权
- **QQ Bot** — Gateway 连接 + Webhook
- **企业微信** — 消息加解密 + webhook 回调

### 🖥️ Web Dashboard

- React + TypeScript + Ant Design
- 会话管理、记忆浏览、技能管理、配置编辑
- 在线对话（WebSocket 流式）
- 记忆维护日志

---

## 配置

配置文件：`~/.lightpilot/config.yaml`

```yaml
model:
  provider: deepseek
  model: deepseek-v4-pro
  base_url: https://api.deepseek.com/v1
  api_key: "sk-your-key-here"

web:
  port: 9741
  auto_open: true

context:
  window_rounds: 20    # 保留最近 N 轮对话
```

运行 `lightpilot setup` 进行交互式配置。

---

## 开发

```bash
git clone http://192.168.3.70:8418/wujun2081/lightPilot.git
cd lightPilot
pip install -e ".[all,dev]"

# 启动服务
lightpilot serve

# 终端对话
lightpilot chat

# 前端开发（另一个终端）
cd web
npm install
npm run dev
```

## License

MIT
