Metadata-Version: 2.4
Name: termux-ai-agent
Version: 3.2.5
Summary: Termux AI Agent - 智能终端助手，支持多平台AI(DeepSeek/阿里云百炼/硅基流动)，JSON模式工具调用、文件精确编辑、后台任务处理、对话历史
Author: 我是个人
Project-URL: Homepage, https://github.com/user/termux-ai-agent
Project-URL: Repository, https://github.com/user/termux-ai-agent.git
Project-URL: Issues, https://github.com/user/termux-ai-agent/issues
Keywords: termux,ai,agent,deepseek,qwen,siliconflow,terminal,assistant,cli
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Android
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Terminals
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: openai==0.28.0
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"

# Termux AI Agent v3.2.5

智能终端助手 —— 专为 Termux 环境设计的 AI Agent，支持多平台 AI（DeepSeek / 阿里云百炼 / 硅基流动）。

## 功能特性

- 多平台 AI 支持 —— DeepSeek、阿里云百炼（通义千问）、硅基流动，一键切换
- JSON 模式工具调用 —— 自动执行 shell 命令、读写文件、访问网页
- 文件精确编辑 —— replace_in_file 只替换需要改的部分
- 后台任务处理 —— 自动识别服务启动命令并加 `&` 后台运行
- 对话历史 —— 实时保存，下次启动可继续对话，支持 AI 自动命名
- 用户自定义规则 —— 嵌入系统提示词，个性化 AI 行为
- 国内镜像源 —— 支持阿里云/清华源/中科大/自定义四种模式
- Token 用量统计 —— 输入 token 命令查看当前对话消耗
- API 错误汉化 —— 常见英文报错自动翻译为中文
- 终端美化 —— lolcat 彩虹特效、打字机动画、加载动画
- Termux 环境检测 —— 启动时自动验证运行环境

## 安装

### 准备工作：安装 Termux

本工具基于 Termux 环境运行，如果你还没有安装 Termux，请先下载安装：

👉 [点击下载 Termux](https://m.32r.com/app/136073.html)

### 第一步：换国内镜像源（加速下载）

`echo "deb https://mirrors.tuna.tsinghua.edu.cn/termux/apt/termux-main stable main" > $PREFIX/etc/apt/sources.list && apt update`

### 第二步：安装 Python

`pkg install python -y`

### 第三步：安装 Termux AI Agent

`python -m pip install termux-ai-agent`

### 第四步：启动

`termux-ai-agent`

### 从源码安装

`git clone https://github.com/user/termux-ai-agent.git`  
`cd termux-ai-agent`  
`pip install -e .`

## 快速开始

安装后直接运行：

`termux-ai-agent`

或者作为 Python 模块运行：

`python -m deepseek_agent`

首次运行需要：
1. 同意用户协议与隐私政策
2. 输入 API Key（支持 DeepSeek、阿里云百炼、硅基流动）

## 可用工具

| 工具 | 功能 |
|------|------|
| run_shell | 执行系统命令 |
| read_file | 读取文件（带行号） |
| write_file | 安全写入文件 |
| replace_in_file | 精确替换文件内容 |
| mkdir | 创建目录 |
| fetch_webpage | 访问网页（Lynx） |
| ask_user | 向用户提问 |

## 特殊命令

| 命令 | 功能 |
|------|------|
| help / 帮助 | 显示帮助信息 |
| setting / 设置 | 打开设置菜单（切换平台/模型/镜像源等） |
| clear | 清屏 |
| token | 查看当前对话 Token 用量（估算） |
| history | 浏览和加载历史对话 |
| reset | 重置对话并删除历史 |
| exit / 退出 | 保存并退出 |

## 支持的 AI 平台

| 平台 | 默认模型 | 获取 Key |
|------|----------|----------|
| DeepSeek | deepseek-v4-pro | https://platform.deepseek.com/api_keys |
| 阿里云百炼 | qwen-max | https://bailian.console.aliyun.com/?apiKey=1 |
| 硅基流动 | Qwen/Qwen3-235B-A22B | https://cloud.siliconflow.cn/account/ak |

## 系统要求

- Android 设备
- Termux 应用（[GitHub](https://github.com/termux/termux-app) 或 [F-Droid](https://f-droid.org/packages/com.termux/)）
- Python 3.8+
- 至少一个平台的 API Key

## 更新日志

### v3.2.5 (2026-07-03)
- 新增：多平台 AI 支持 —— DeepSeek / 阿里云百炼（通义千问）/ 硅基流动
- 新增：分平台独立存储 API Key，互不覆盖
- 新增：API 错误信息自动汉化
- 新增：token 命令 —— 查看当前对话 Token 用量（估算）
- 新增：终端美化 —— lolcat 彩虹特效 + 打字机动画 + 加载动画
- 新增：用户输入去重 + 工具调用结果缓存
- 新增：AI 自动为会话生成简短名称
- 优化：设置菜单增加 AI 平台切换入口

### v3.2.0 (2026-06-28)
- 修复：pkg 安装阻塞 —— 安装策略优化，优先使用系统默认源，失败后自动切换镜像
- 修复：工具调用异常 —— 参数解析失败时向 API 返回错误消息，避免对话卡死
- 优化：Termux 环境自动检测 —— 启动时自动验证运行环境

### v3.1.2 (2026-06-25)
- 优化：完善 README.md 文档，新增 Termux 下载链接
- 优化：新增作者主页链接

### v3.1.1 (2026-06-24)
- 修复：README.md 格式问题，优化 PyPI 页面显示
- 优化：完善项目文档，新增从零开始安装步骤

### v3.1.0 (2026-06-23)
- 新增：首次发布到 PyPI，包名 deepseek-agent-2026
- 新增：支持 pip install 安装
- 功能：JSON 模式工具调用、用户自定义规则、对话历史、国内镜像源

### v3.0.0 (2026-05-09)
- 新增：用户自定义规则系统
- 新增：reset 命令，重置对话并清除历史
- 新增：关于页面

### v2.9.0 (2026-05)
- 新增：文件读取带行号
- 新增：安全文件写入
- 优化：动态输出规则

### v2.8.0 (2026-04)
- 新增：对话历史记录
- 新增：后台任务智能识别
- 优化：搜索引擎优化

### v2.7.0 及更早
- 新增：JSON 模式工具调用
- 新增：自动安装依赖
- 新增：彩色终端输出
- 新增：设置中心

## 卸载

`python -m pip uninstall termux-ai-agent -y`

## 作者主页

👉 [作者主页：https://www.rtsbox.cn/author/17993?t=0#67m5s](https://www.rtsbox.cn/author/17993?t=0#67m5s)

## 许可证

MIT License
