AICommit - AI-Powered Commit Message Generator
AICommit 是一个由 AI 驱动的 VSCode 扩展,旨在帮助开发者快速生成高质量的 Git 提交消息。通过自定义 AI 模型和提示词,您可以根据自己的需求生成符合项目风格的提交消息。支持多种 API,如 OpenAI、One-API、New-API 等,灵活适应不同的 AI 服务。
AICommit is an AI-powered VSCode extension designed to help developers quickly generate high-quality Git commit messages. With customizable AI models and prompts, you can tailor the generated messages to match your project's style. It supports various APIs such as OpenAI, One-API, New-API, and more, offering flexibility to adapt to different AI services.
功能 | Features
AI 生成提交消息: 根据您的 Git 更改自动生成描述性提交消息。
自定义 AI 模型: 支持任何兼容 OpenAI API 的模型,包括 One-API、New-API 等自定义服务。
自定义提示词: 允许您定义生成提交消息的提示词,确保风格一致。
按钮式交互: 在源代码管理视图中提供直观的按钮,简化操作流程。
多语言支持: 提供中英文界面和文档,方便全球开发者使用。
AI-Generated Commit Messages: Automatically generate descriptive commit messages based on your Git changes.
Custom AI Models: Supports any OpenAI API-compatible model, including custom services like One-API and New-API.
Custom Prompts: Allows you to define the prompt for generating commit messages, ensuring consistent style.
Button-Based Interaction: Provides an intuitive button in the Source Control view for streamlined operation.
Multilingual Support: Offers bilingual (Chinese and English) interface and documentation for global developers.
安装 | Installation
从 VSCode 市场安装:
- 打开 VSCode,点击左侧扩展图标 (Ctrl+Shift+X)。
- 搜索 "AICommit" 并点击安装。
从源代码安装 (开发模式):
- 克隆仓库到本地:
git clone <repository-url>
- 进入项目目录:
cd aicommit
- 运行
code --extensionDevelopmentPath=. .
加载扩展。
Install from VSCode Marketplace:
- Open VSCode, click the Extensions icon on the left (Ctrl+Shift+X).
- Search for "AICommit" and click Install.
Install from Source (Development Mode):
- Clone the repository locally:
git clone <repository-url>
- Navigate to the project directory:
cd aicommit
- Run
code --extensionDevelopmentPath=. .
to load the extension.
配置 | Configuration
AICommit 提供多种配置选项,您可以在 VSCode 设置中自定义这些参数。以下是配置项的详细说明和示例:
AICommit offers various configuration options that you can customize in VSCode settings. Below are detailed explanations and examples for each configuration:
aicommit.apiBaseUrl:
- 描述 | Description: AI API 的基础 URL,支持任何兼容 OpenAI API 的服务。
- 默认值 | Default:
https://api.openai.com/v1
- 示例 | Example:
- OpenAI:
https://api.openai.com/v1
- One-API:
https://api.one-api.com/v1
- New-API:
https://api.new-api.com/v1
aicommit.apiKey:
- 描述 | Description: 用于身份验证的 API 密钥,确保您的 API 调用安全。
- 默认值 | Default: 空 (需要用户设置)
- 示例 | Example:
sk-your-api-key-here
aicommit.modelName:
- 描述 | Description: 使用的 AI 模型名称,支持多种模型以适应不同需求。
- 默认值 | Default:
grok-3-fast
- 示例 | Example:
- OpenAI:
gpt-3.5-turbo
, gpt-4
- 自定义模型:
grok-3-fast
aicommit.prompt:
- 描述 | Description: 生成提交消息的提示词,可自定义以匹配项目风格。
- 默认值 | Default:
Generate a commit message based on the changes
- 示例 | Example:
- 简洁风格:
Summarize the changes in a short commit message
- 详细风格:
Provide a detailed commit message including the purpose and impact of the changes
- 特定格式:
Generate a commit message in the format: [type](https://github.com/ruiwarn/aicommit/blob/HEAD/scope): description
aicommit.internalAuthId:
- 描述 | Description: 用于激活内置 AI 配置的特定授权 ID(如果开发者提供了此选项)。留空则使用您自己的全局 AI 设置 (
apiKey
, apiBaseUrl
, modelName
)。
- 默认值 | Default: 空
- 示例 | Example:
YOUR_PROVIDED_AUTH_ID
aicommit.maxTokenLength:
- 描述 | Description: 发送到 AI API 的
git diff
内容的最大字符数(默认为 128k)。超出的部分将被截断。
- 默认值 | Default:
128000
- 示例 | Example:
64000
配置步骤 | Configuration Steps
打开 VSCode 设置 (Ctrl+, 或 File > Preferences > Settings)。
搜索 "AICommit Configuration"。
根据需要设置上述参数。
Open VSCode Settings (Ctrl+, or File > Preferences > Settings).
Search for "AICommit Configuration".
Set the parameters as needed.
使用 | Usage
首次使用与引导设置 | First Use & Guided Setup
如果您是首次使用 AICommit,或者尚未在 VSCode 设置中配置 aicommit.apiKey
或 aicommit.internalAuthId
,插件将在您第一次尝试生成提交消息时自动启动引导设置流程:
- 选择配置方式: 插件会询问您是想“配置自己的 AI”(需要提供 API Key 等信息)还是“使用内置 AI”(需要提供开发者提供的授权 ID)。
- 输入信息: 根据您的选择,插件会提示您输入必要的信息(如 API Key、Base URL、模型名称或授权 ID)。
- 自动保存: 您输入的信息将自动保存到 VSCode 的全局设置中。
- 重新运行: 配置保存后,请重新点击 "Generate Commit Message" 按钮以使用新设置。
If you are using AICommit for the first time, or if you haven't configured either aicommit.apiKey
or aicommit.internalAuthId
in your VSCode settings, the extension will automatically launch a guided setup process when you first try to generate a commit message:
- Choose Configuration Method: The extension will ask whether you want to "Configure Own AI" (requiring your API Key and other details) or "Use Built-in AI" (requiring a specific Authorization ID provided by the developer).
- Enter Information: Based on your choice, you will be prompted to enter the necessary information (like API Key, Base URL, Model Name, or Authorization ID).
- Automatic Saving: The information you provide will be automatically saved to your VSCode global settings.
- Re-run Command: After the configuration is saved, please click the "Generate Commit Message" button again to use the new settings.
常规使用 | Regular Usage
Staging 更改 | Staging Changes:
- 在 VSCode 中进行代码更改后,使用
git add
命令或源代码管理视图中的 "+" 按钮来 staging 更改。
- After making code changes in VSCode, use the
git add
command or the "+" button in the Source Control view to stage changes.
生成提交消息:
- 转到源代码管理视图 (Ctrl+Shift+G)。
- 点击 "Generate Commit Message" 按钮 (带有灯泡图标)。
- 如果配置正确,AI 将根据您的更改生成提交消息并填充到 Git 提交信息框中。
- Go to the Source Control view (Ctrl+Shift+G).
- Click the "Generate Commit Message" button (with a lightbulb icon).
- If configured correctly, the AI will generate a commit message based on your changes and populate it into the Git commit input box.
提交更改 | Committing Changes:
- 查看并(可选地)编辑填充的提交消息后,点击 Git 面板上的提交按钮(通常是一个勾号图标)来提交您的更改。
- After reviewing and (optionally) editing the populated commit message, click the commit button (usually a checkmark icon) in the Git panel to commit your changes.
特色 | Highlights
高度自定义: 通过自定义 API 端点、模型和提示词,AICommit 可以适应任何 AI 服务和项目需求。
用户友好: 直观的按钮界面简化了提交消息生成过程,无需手动输入命令。
跨平台支持: 在 Windows、macOS 和 Linux 上无缝运行。
开源与商业支持: 免费使用,同时提供商业支持选项以获取额外功能和优先支持。
Highly Customizable: With custom API endpoints, models, and prompts, AICommit adapts to any AI service and project needs.
User-Friendly: Intuitive button interface simplifies the commit message generation process without manual command input.
Cross-Platform Support: Runs seamlessly on Windows, macOS, and Linux.
Open Source & Commercial Support: Free to use with commercial support options for additional features and priority assistance.
故障排除 | Troubleshooting
API 请求失败: 确保您的 apiBaseUrl
和 apiKey
配置正确。如果使用自定义服务,请检查其文档以确保兼容性。
无提交消息生成: 确保您已 staging 更改 (git add
)。如果仍然没有输出,请检查 Git 安装和配置。
按钮不可见: 确保您在源代码管理视图中,并且已正确加载扩展。
API Request Failed: Ensure your apiBaseUrl
and apiKey
are configured correctly. If using a custom service, check its documentation for compatibility.
No Commit Message Generated: Make sure you have staged changes (git add
). If still no output, check your Git installation and configuration.
Button Not Visible: Ensure you are in the Source Control view and the extension is loaded correctly.
支持 | Support
如果您有任何问题或需要帮助,请通过以下方式联系我们:
- GitHub Issues: 在我们的仓库提交问题。
- 电子邮件: support@aicommit.com
- 商业支持: 联系我们获取高级支持计划。
For any questions or assistance, reach out to us via:
- GitHub Issues: Submit issues on our repository.
- Email: support@aicommit.com
- Commercial Support: Contact us for premium support plans.
贡献 | Contributing
欢迎贡献!请查看我们的 GitHub 仓库以获取贡献指南。
Contributions are welcome! Please check our GitHub repository for contribution guidelines.
许可证 | License
此扩展根据 MIT 许可证发布。详情请见 LICENSE 文件。
This extension is released under the MIT License. See the LICENSE file for details.