Tavernari commited on
Commit
cc92d01
·
verified ·
1 Parent(s): 8696e02

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +133 -3
README.md CHANGED
@@ -1,3 +1,133 @@
1
- ---
2
- license: ecl-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Git Commit Message Generator (Reasoning Version)
2
+
3
+ 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.
4
+
5
+ **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.
6
+
7
+ **Beta Status**: This version is in beta. Your feedback is essential to refine it further!
8
+
9
+ ## Output Format
10
+
11
+ The model outputs two main components wrapped in a structured format:
12
+
13
+ 1. **Reasoning**: A detailed breakdown of the changes in your diff and the logic behind the commit message.
14
+ 2. **Commit Message**: A concise summary of the changes, followed by a more detailed description.
15
+
16
+ **Example Output**:
17
+
18
+ ```
19
+ <reasoning>
20
+ The diff shows changes in `WalletManagerView.swift`. The most significant changes are the
21
+ addition of a new `@State` variable `monthlySpentGoal` and modifications to existing functions
22
+ and state variables. The `monthlySpentGoal` is now used in various places, such as in the
23
+ `onSave` closure and in the `hasChanges` function. The purpose of these changes is to add a new
24
+ feature that allows users to set a monthly spending goal for their wallets, which can be
25
+ updated and saved with other wallet information.
26
+
27
+ The changes include:
28
+ - Adding a new `@State` variable `monthlySpentGoal`.
29
+ - Updating the `onSave` closure to include `monthlySpentGoal`.
30
+ - Using `monthlySpentGoal` in the `hasChanges` function to determine if the wallet's spending
31
+ goal has changed.
32
+ - Adding a new section `WalletGoalSpentSection` that uses `monthlySpentGoal`.
33
+ - Updating the `onSetAsMain` function to use `monthlySpentGoal`.
34
+ </reasoning>
35
+ Add monthly spending goal feature to WalletManagerView
36
+
37
+ This commit adds a new `@State` variable `monthlySpentGoal` to the `WalletManagerView` and
38
+ updates the `onSave` closure and related functions to include and use this variable. This
39
+ feature allows users to set and save a monthly spending goal for their wallets, enhancing the
40
+ wallet management functionality.
41
+ ```
42
+
43
+ This format gives you both the "why" and the "what" of your commit, enhancing clarity and context.
44
+
45
+ ## Using the Model
46
+
47
+ You can interact with the model in two ways:
48
+
49
+ ### 1. Web Interface
50
+ - Go to the [Hugging Face Model Page](https://huggingface.co/Tavernari/git-commit-message).
51
+ - Paste your git diff into the input box.
52
+ - Click "Generate" to get the reasoning and commit message.
53
+
54
+ ### 2. API Integration
55
+ - Use the Hugging Face Inference API to integrate the model into your workflows.
56
+ - Example in Python:
57
+
58
+ ```python
59
+ import requests
60
+
61
+ API_URL = "https://api-inference.huggingface.co/models/Tavernari/git-commit-message"
62
+ headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
63
+
64
+ def query(payload):
65
+ response = requests.post(API_URL, headers=headers, json=payload)
66
+ return response.json()
67
+
68
+ diff = """
69
+ diff --git a/file1.py b/file1.py
70
+ index 83db48f..bf2a9a2 100644
71
+ --- a/file1.py
72
+ +++ b/file1.py
73
+ @@ -1,3 +1,4 @@
74
+ def hello():
75
+ print("Hello, world!")
76
+ + print("Welcome to AI commit messages!")
77
+ """
78
+ output = query({"inputs": diff})
79
+ print(output)
80
+ ```
81
+
82
+ - Replace `YOUR_HF_TOKEN` with your Hugging Face API token. The response will include both reasoning and the commit message.
83
+
84
+ ## Tips for Best Results
85
+
86
+ - **Clear Diffs**: Use small, focused diffs for more accurate messages.
87
+ - **Proper Formatting**: Ensure your diff is well-formatted for the model to interpret it correctly.
88
+ - **Output Handling**: When using the API, parse the response to separate reasoning and the commit message if needed.
89
+
90
+ ## Installing `git-gen-commit` (Optional)
91
+
92
+ For a command-line experience, you can install the `git-gen-commit` script, which generates commit messages from your git diff.
93
+
94
+ **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).
95
+
96
+ ### Installation (macOS/Linux)
97
+ Run this command to install `git-gen-commit` globally:
98
+
99
+ ```bash
100
+ sudo sh -c 'curl -L https://gist.githubusercontent.com/Tavernari/b88680e71c281cfcdd38f46bdb164fee/raw/git-gen-commit \
101
+ -o /usr/local/bin/git-gen-commit && chmod +x /usr/local/bin/git-gen-commit'
102
+ ```
103
+
104
+ ### Usage
105
+ Once installed, run:
106
+
107
+ ```bash
108
+ git gen-commit
109
+ ```
110
+
111
+ This will analyze your current git diff and generate a commit message via the Ollama API.
112
+
113
+ ## Feedback and Contributions
114
+
115
+ This is a community-driven project, and your input helps it grow!
116
+
117
+ - **Feedback**: Submit diffs and results via this [form](https://docs.google.com/forms/u/0/d/e/1FAIpQLScfFOxawM7YBHucl_RDmAwkPFBp9HARZt7RY2iaDhmKONKC3w/formResponse). Use 👍 for good outputs and 👎 for issues.
118
+ - **Support**: If you’d like to fuel this passion project, consider a donation: [Buy me a coffee ☕️](https://donate.stripe.com/14k3d8dFqfeI96E8ww).
119
+
120
+ ## Disclaimer
121
+
122
+ This tool is still evolving. Please review generated messages for accuracy before committing.
123
+
124
+ ## Get in Touch
125
+
126
+ I’d love to hear from you! Connect with me at:
127
+
128
+ - [LinkedIn](https://www.linkedin.com/in/victorctavernari/)
129
+ - [GitHub](https://github.com/Tavernari)
130
+ - [Twitter](https://twitter.com/vituu)
131
+ - Email: [email protected]
132
+
133
+ Let’s make AI-powered development even better together!