初始化项目,由ModelHub XC社区提供模型
Model: Tavernari/git-commit-message Source: Original Platform
This commit is contained in:
144
README.md
Normal file
144
README.md
Normal file
@@ -0,0 +1,144 @@
|
||||
---
|
||||
datasets:
|
||||
- Tavernari/git-commit-message-dt
|
||||
metrics:
|
||||
- accuracy
|
||||
pipeline_tag: summarization
|
||||
tags:
|
||||
- git
|
||||
- commit
|
||||
- message
|
||||
---
|
||||
# Git Commit Message Generator (Reasoning Version)
|
||||
|
||||
Welcome to the **Git Commit Message Generator**—an AI-powered tool that turns your code diffs into clear, meaningful commit messages with detailed reasoning. Hosted on Hugging Face, this reasoning version not only provides a commit message but also explains the thought process behind it, making your commit history more transparent and informative.
|
||||
|
||||
**Note**: This is the reasoning version of the Git Commit Message Generator. For other versions (e.g., Chain of Draft or standard), check out my [Ollama repository](https://ollama.com/tavernari/git-commit-message) for more details.
|
||||
|
||||
**Beta Status**: This version is in beta. Your feedback is essential to refine it further!
|
||||
|
||||
## Output Format
|
||||
|
||||
The model outputs two main components wrapped in a structured format:
|
||||
|
||||
1. **Reasoning**: A detailed breakdown of the changes in your diff and the logic behind the commit message.
|
||||
2. **Commit Message**: A concise summary of the changes, followed by a more detailed description.
|
||||
|
||||
**Example Output**:
|
||||
|
||||
```
|
||||
<reasoning>
|
||||
The diff shows changes in `WalletManagerView.swift`. The most significant changes are the
|
||||
addition of a new `@State` variable `monthlySpentGoal` and modifications to existing functions
|
||||
and state variables. The `monthlySpentGoal` is now used in various places, such as in the
|
||||
`onSave` closure and in the `hasChanges` function. The purpose of these changes is to add a new
|
||||
feature that allows users to set a monthly spending goal for their wallets, which can be
|
||||
updated and saved with other wallet information.
|
||||
|
||||
The changes include:
|
||||
- Adding a new `@State` variable `monthlySpentGoal`.
|
||||
- Updating the `onSave` closure to include `monthlySpentGoal`.
|
||||
- Using `monthlySpentGoal` in the `hasChanges` function to determine if the wallet's spending
|
||||
goal has changed.
|
||||
- Adding a new section `WalletGoalSpentSection` that uses `monthlySpentGoal`.
|
||||
- Updating the `onSetAsMain` function to use `monthlySpentGoal`.
|
||||
</reasoning>
|
||||
Add monthly spending goal feature to WalletManagerView
|
||||
|
||||
This commit adds a new `@State` variable `monthlySpentGoal` to the `WalletManagerView` and
|
||||
updates the `onSave` closure and related functions to include and use this variable. This
|
||||
feature allows users to set and save a monthly spending goal for their wallets, enhancing the
|
||||
wallet management functionality.
|
||||
```
|
||||
|
||||
This format gives you both the "why" and the "what" of your commit, enhancing clarity and context.
|
||||
|
||||
## Using the Model
|
||||
|
||||
You can interact with the model in two ways:
|
||||
|
||||
### 1. Web Interface
|
||||
- Go to the [Hugging Face Model Page](https://huggingface.co/Tavernari/git-commit-message).
|
||||
- Paste your git diff into the input box.
|
||||
- Click "Generate" to get the reasoning and commit message.
|
||||
|
||||
### 2. API Integration
|
||||
- Use the Hugging Face Inference API to integrate the model into your workflows.
|
||||
- Example in Python:
|
||||
|
||||
```python
|
||||
import requests
|
||||
|
||||
API_URL = "https://api-inference.huggingface.co/models/Tavernari/git-commit-message"
|
||||
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
|
||||
|
||||
def query(payload):
|
||||
response = requests.post(API_URL, headers=headers, json=payload)
|
||||
return response.json()
|
||||
|
||||
diff = """
|
||||
diff --git a/file1.py b/file1.py
|
||||
index 83db48f..bf2a9a2 100644
|
||||
--- a/file1.py
|
||||
+++ b/file1.py
|
||||
@@ -1,3 +1,4 @@
|
||||
def hello():
|
||||
print("Hello, world!")
|
||||
+ print("Welcome to AI commit messages!")
|
||||
"""
|
||||
output = query({"inputs": diff})
|
||||
print(output)
|
||||
```
|
||||
|
||||
- Replace `YOUR_HF_TOKEN` with your Hugging Face API token. The response will include both reasoning and the commit message.
|
||||
|
||||
## Tips for Best Results
|
||||
|
||||
- **Clear Diffs**: Use small, focused diffs for more accurate messages.
|
||||
- **Proper Formatting**: Ensure your diff is well-formatted for the model to interpret it correctly.
|
||||
- **Output Handling**: When using the API, parse the response to separate reasoning and the commit message if needed.
|
||||
|
||||
## Installing `git-gen-commit` (Optional)
|
||||
|
||||
For a command-line experience, you can install the `git-gen-commit` script, which generates commit messages from your git diff.
|
||||
|
||||
**Disclaimer**: The `git-gen-commit` script uses the Ollama API, not the Hugging Face model. Results may differ from this reasoning version. For more details, visit my [Ollama repository](https://ollama.com/tavernari/git-commit-message).
|
||||
|
||||
### Installation (macOS/Linux)
|
||||
Run this command to install `git-gen-commit` globally:
|
||||
|
||||
```bash
|
||||
sudo sh -c 'curl -L https://gist.githubusercontent.com/Tavernari/b88680e71c281cfcdd38f46bdb164fee/raw/git-gen-commit \
|
||||
-o /usr/local/bin/git-gen-commit && chmod +x /usr/local/bin/git-gen-commit'
|
||||
```
|
||||
|
||||
### Usage
|
||||
Once installed, run:
|
||||
|
||||
```bash
|
||||
git gen-commit
|
||||
```
|
||||
|
||||
This will analyze your current git diff and generate a commit message via the Ollama API.
|
||||
|
||||
## Feedback and Contributions
|
||||
|
||||
This is a community-driven project, and your input helps it grow!
|
||||
|
||||
- **Feedback**: Use the community tab to give us feedback.
|
||||
- **Support**: If you’d like to fuel this passion project, consider a donation: [Buy me a coffee ☕️](https://donate.stripe.com/14k3d8dFqfeI96E8ww).
|
||||
|
||||
## Disclaimer
|
||||
|
||||
This tool is still evolving. Please review generated messages for accuracy before committing.
|
||||
|
||||
## Get in Touch
|
||||
|
||||
I’d love to hear from you! Connect with me at:
|
||||
|
||||
- [LinkedIn](https://www.linkedin.com/in/victorctavernari/)
|
||||
- [GitHub](https://github.com/Tavernari)
|
||||
- [Twitter](https://twitter.com/vituu)
|
||||
- Email: victortavernari+gitcommitmessage@gmail.com
|
||||
|
||||
Let’s make AI-powered development even better together!
|
||||
Reference in New Issue
Block a user