Command-line agent
Project description
GG CLI - 大模型命令行工具
一个功能强大的命令行大模型工具,支持多种LLM提供商,提供交互式聊天和终端命令执行功能。
✨ 特性
- 💬 交互式聊天: 提供流畅的命令行聊天体验
- ⚡ 终端集成: 内置终端命令执行功能,支持跨平台
📦 安装
从PyPI安装(更新中)
pip install gg-cli
🚀 快速开始
1. 首次配置
# 添加LLM配置
gg add
# 跟随向导完成配置
# 您需要获取大模型服务商的 url 和 api_key
# 添加完成后,使用list查看配置
gg list
2. 开始聊天
# 交互式聊天模式
gg
# 发送单条消息
gg "你好,请介绍一下自己"
📖 使用指南
配置管理
添加配置
gg add
交互式添加新的LLM配置,包括:
- name: 配置标识名称(可选,默认为当前日期)
- api_key: API密钥(必需)
- base_url: API基础URL(默认:https://api.openai.com/v1)
- model: 模型名称(必需)
- temperature: 温度参数0.0-2.0(默认:0.7)
查看配置
gg list
显示所有已保存的LLM配置信息。
更新配置
gg update
交互式更新现有配置(除名称外)。
删除配置
gg delete
删除指定的LLM配置。
设置默认配置
gg default
从现有配置中选择一个设为默认LLM。
聊天模式
交互式聊天
gg
启动交互式聊天模式,支持:
- 连续对话
- 终端命令执行
- 多轮对话上下文保持
退出聊天
在聊天模式中输入以下任一命令退出:
\q或\quit\e或\exitCtrl+C
终端功能
GG CLI集成了强大的终端功能:
- 命令执行: 支持执行系统命令
- 跨平台: 自动适配Windows PowerShell、Linux Bash、macOS Zsh
- 安全确认: 执行命令前需要用户确认
- 实时输出: 实时显示命令执行结果
- 错误处理: 完善的错误处理和超时机制
🔧 配置说明
配置文件位置
- Windows:
%APPDATA%\gg-cli\gg-cli\config.enc - Linux/macOS:
~/.config/gg-cli/config.enc
支持的LLM提供商
| 提供商 | Base URL | 示例模型 |
|---|---|---|
| OpenAI | https://api.openai.com/v1 | gpt-4, gpt-3.5-turbo |
| 阿里云通义千问 | https://dashscope.aliyuncs.com/compatible-mode/v1 | qwen-max, qwen-plus |
| 其他兼容OpenAI API的服务 | 自定义 | 自定义 |
📋 系统要求
- Python 3.12+
- 支持的操作系统:Windows、Linux、macOS
- 网络连接(用于API调用)
🛠️ 开发
项目结构
gg-cli/
├── gg_main.py # 主程序入口
├── llm.py # LLM核心功能
├── file.py # 配置文件管理
├── pyproject.toml # 项目配置
└── README.md # 说明文档
依赖项
openai>=1.102.0: OpenAI API客户端requests>=2.32.5: HTTP请求库appdirs>=1.4.4: 跨平台应用目录管理
🤝 贡献
欢迎提交Issue和Pull Request!
作者邮箱:241098038@smail.nju.edu.cn
📄 许可证
本项目采用MIT许可证。
🔗 相关链接
注意: 使用前请确保已获得相应LLM提供商的API访问权限。
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
gg_cli-0.1.2.tar.gz
(26.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
gg_cli-0.1.2-py3-none-any.whl
(11.5 kB
view details)
File details
Details for the file gg_cli-0.1.2.tar.gz.
File metadata
- Download URL: gg_cli-0.1.2.tar.gz
- Upload date:
- Size: 26.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
328ba7fd8936b255575565919de173ca83846e571fc99c716baa3741969ecd28
|
|
| MD5 |
4475f7109470f705f661ef9047301bf3
|
|
| BLAKE2b-256 |
e2d795db94381413d79310170f4d58e2f272b82d7c31e5cf2b7bda00c8daca9d
|
File details
Details for the file gg_cli-0.1.2-py3-none-any.whl.
File metadata
- Download URL: gg_cli-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43c96fbdd6503ecc913106449e8cccf54754fd9372441be45f21ba4c80bff421
|
|
| MD5 |
57f78f5e924e5950323e97aae4521ba5
|
|
| BLAKE2b-256 |
7570381073ba9f85b10355b7c916a58437c6139118059d176b4b422a813b6ba7
|