项目简介
一款功能强大的开源终端 AI 助手:gptme。
安装了它,你可以在终端上执行本地代码、读写文件、搜索和浏览网页以及进行视觉识别等操作。
支持目前主流 LLM 提供商,如 OpenAI、Anthropic 和 OpenRouter,也可以使用 llama.cpp 在本地提供服务。
🌟 特点
-
💻 代码执行
-
在您的本地环境中使用 shell 和 Python 工具执行代码。
-
阅读、写入和更改文件
-
使用补丁工具进行增量更改。
-
🌐 搜索和浏览网页。
-
可以使用 Playwright 浏览器工具通过浏览器。
-
👀 视觉
-
可以看到提示中引用的图片、桌面截图和网页。
-
🔄 自我校正
-
输出反馈给助手,使其能够响应并自我纠正。
-
支持多个LLM提供商
-
使用 OpenAI、Anthropic、OpenRouter 或使用
llama.cpp
本地提供服务 -
🌐 网页界面和 REST API
-
现代网页界面在 chat.gptme.org(gptme-webui)
-
Python 包中包含的简单内置 Web UI
-
服务器带 REST API
-
💻 计算机使用工具,如 Anthropic 所宣传的(见#216)
-
给予助手访问完整桌面的权限,使其能够与 GUI 应用程序交互。
-
🤖 长运行代理和高级代理架构(见 #143 和 #259)
-
创建使用 gptme-agent-template 模板的持久性代理
-
✨ 许多小功能确保优质体验
-
Tab 补全和命令及路径的高亮显示
-
传递一个文件名作为参数将读取该文件并将其包含为上下文。
-
通过
stdin
或作为参数进行管道操作。 -
智能补全和突出显示:
-
自动命名对话
-
✅ 检测并集成预提交
-
语音合成支持,本地使用 Kokoro 生成
-
高级用法功能标志,请参阅配置文档
🛠 用例
-
🖥 开发:借助 AI 辅助,更快地编写和运行代码。
-
🎯 Shell 专家:使用自然语言获取正确的命令(不再需要记忆标志!)。
-
数据分析:直接在您的终端中处理和分析数据。
-
互动学习:亲身体验新技术或代码库。
-
🤖 代理与工具:在本地环境中实验代理与工具。
🛠 Developer perks
-
工具箱 易扩展
-
大多数功能都作为工具实现,这使得添加新功能变得容易。
-
广泛测试,高覆盖率。
-
干净代码库,使用
mypy
、ruff
和pyupgrade
检查和格式化。 -
GitHub 机器人从评论中请求更改!(见#16)
-
在此仓库中运行!(见 #18 举例)
-
完全运行在 GitHub Actions 中。
-
📊 评估套件,用于测试不同模型的性能
-
gptme.vim 用于轻松集成到 Vim 中
🚀 开始使用
使用 pipx 安装:
# requires Python 3.10+
pipx install gptme
现在,要开始,请运行:
gptme
这里有一些示例:
gptme 'write an impressive and colorful particle effect using three.js to particles.html'
gptme 'render mandelbrot set to mandelbrot.png'
gptme 'suggest improvements to my vimrc'
gptme 'convert to h265 and adjust the volume' video.mp4
git diff | gptme 'complete the TODOs in this diff'
make test | gptme 'fix the failing tests'
🛠 使用方法
$ gptme --help
Usage: gptme [OPTIONS] [PROMPTS]...
gptme is a chat-CLI for LLMs, empowering them with tools to run shell
commands, execute code, read and manipulate files, and more.
If PROMPTS are provided, a new conversation will be started with it. PROMPTS
can be chained with the '-' separator.
The interface provides user commands that can be used to interact with the
system.
Available commands:
/undo Undo the last action
/log Show the conversation log
/tools Show available tools
/edit Edit the conversation in your editor
/rename Rename the conversation
/fork Create a copy of the conversation with a new name
/summarize Summarize the conversation
/replay Re-execute codeblocks in the conversation, wont store output in log
/impersonate Impersonate the assistant
/tokens Show the number of tokens used
/export Export conversation as standalone HTML
/help Show this help message
/exit Exit the program
Options:
-n, --name TEXT Name of conversation. Defaults to generating a random
name.
-m, --model TEXT Model to use, e.g. openai/gpt-4o,
anthropic/claude-3-5-sonnet-20240620. If only
provider given, a default is used.
-w, --workspace TEXT Path to workspace directory. Pass '@log' to create a
workspace in the log directory.
-r, --resume Load last conversation
-y, --no-confirm Skips all confirmation prompts.
-n, --non-interactive Force non-interactive mode. Implies --no-confirm.
--system TEXT System prompt. Can be 'full', 'short', or something
custom.
-t, --tools TEXT Comma-separated list of tools to allow. Available:
read, save, append, patch, shell, subagent, tmux,
browser, gh, chats, screenshot, vision, computer,
python.
--no-stream Don't stream responses
--show-hidden Show hidden system messages.
-v, --verbose Show verbose output.
--version Show version and configuration information
--help Show this message and exit.
项目链接
https://github.com/ErikBjare/gptme
扫码加入技术交流群,备注「开发语言-城市-昵称」
(文:GitHubStore)