9 Commits

Author SHA1 Message Date
6c18e41b00 Add logo to README and new image file
- Added centered logo to `README.md` using `<p>` and `<img>` tags.
- Added new image file `docs/ait.webp`.
2024-08-19 21:03:25 +02:00
3f5c2cec4f Add project time badge to README
- Added a time tracking badge to the top of the README
- Badge source: `https://waka.mpassarello.de/api/badge/MaxP/interval:any/project:Ait?label=Project%20time`
2024-08-19 20:21:18 +02:00
Max P.
7f4c75e606 Update version and configuration settings (#3)
### Modifications
- Updated `VERSION` file from `0.0.5` to `0.0.6`.
- Modified `ait.commit.sample.config.json`:
  - Adjusted `temperature` from 0.7 to 0.6.
- Modified `ait.pull_request.sample.config.json`:
  - Revised the prompt to exclude closing statements.
  - Increased `max_tokens` from 1000 to 2000.
  - Adjusted `temperature` from 0.7 to 0.6.

### Description
This pull request includes updates to the version number and
configuration settings for the commit and pull request message
generator:

1. **Version Update**:
- The version number in the `VERSION` file has been incremented from
`0.0.5` to `0.0.6`.

2. **Commit Sample Config Adjustments**:
- The `temperature` setting in `ait.commit.sample.config.json` has been
lowered from 0.7 to 0.6 to refine the output generation.

3. **Pull Request Sample Config Enhancements**:
- The prompt in `ait.pull_request.sample.config.json` was updated to
exclude any closing statements or generic sentences.
- The `max_tokens` parameter was increased from 1000 to 2000 to allow
for more detailed output.
- The `temperature` setting was also adjusted from 0.7 to 0.6 for
consistent behavior across configurations.
2024-08-19 20:17:47 +02:00
a6dde44a84 Update version number to 0.0.6
- Changed version number in `VERSION` file from `0.0.5` to `0.0.6`
2024-08-19 20:16:05 +02:00
5cc850b8a9 Update PR message config and model settings
- Modified the prompt to exclude closing statements.
- Increased `max_tokens` from 1000 to 2000.
- Adjusted `temperature` from 0.7 to 0.6.
2024-08-19 20:15:29 +02:00
ad14e31b75 Lower temperature setting in commit sample config
- Adjusted `temperature` value from 0.7 to 0.6 in commit sample config file
2024-08-19 20:15:20 +02:00
22972d578c Update version number to 0.0.5
- Changed version in `VERSION` file from `0.0.4` to `0.0.5`
- Note: No newline at end of file
2024-08-19 19:52:03 +02:00
a48f4638c0 Update git log command format
- Modified the `log_command` to use a more detailed pretty format
  - Changed to `--pretty="format:%h%n%ad%n%s%n%n%b%n---%n"`
2024-08-19 19:52:03 +02:00
b50de01653 Add .gitattributes file
- Created `.gitattributes` file
- Configured `* text=auto eol=lf` setting
2024-08-19 19:52:03 +02:00
7 changed files with 13 additions and 6 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
* text=auto eol=lf

View File

@@ -1,3 +1,9 @@
![Time](https://waka.mpassarello.de/api/badge/MaxP/interval:any/project:Ait?label=Project%20time)
<p align="center">
<img width="600" src="./docs/ait.webp">
</p>
# AI-Generated Messages from Git Diffs and Logs
This script uses the OpenAI API to generate text based on the outputs of `git diff` and `git log` commands. It can be particularly useful for creating pull request descriptions, commit messages, or any other narrative that requires summarizing changes between different branches or commits in a Git repository.

View File

@@ -1 +1 @@
0.0.4
0.0.6

View File

@@ -6,5 +6,5 @@
"prompt": "Generate a concise commit message based on the provided Git diffs, including:\\n - A short and direct subject line (under 50 characters) summarizing the specific changes. No formatting should be used in the subject line.\\n - A brief bullet-point list of the exact modifications made, with basic Markdown formatting allowed in the body.\\n \\n Focus strictly on the changes themselves, avoiding any speculation about the reasons or potential impacts. Ensure that the message is informative enough to understand the changes without needing additional context.",
"model": "gpt-4o",
"max_tokens": 1000,
"temperature": 0.7
"temperature": 0.6
}

View File

@@ -3,8 +3,8 @@
"diff_expression": "main...",
"log_expression": "main...",
"system_prompt": "**You are an automatic pull request message generator and an expert in this field!**",
"prompt": "Generate a concise pull request message based on the provided Git diffs, including:\\n - A short and direct subject line (under 50 characters) summarizing the specific changes. No formatting should be used in the subject line.\\n - A brief bullet-point list of the exact modifications made, with basic Markdown formatting allowed in the body.\\n - A detailed description in Markdown format explaining the changes, their purpose, and any additional context that is relevant for the reviewers.\\n \\n Focus strictly on the changes themselves, avoiding any speculation about the reasons or potential impacts beyond the modifications. Ensure that the message is informative enough to understand the changes and their context for a comprehensive review.",
"prompt": "Generate a concise pull request message based on the provided Git diffs, including:\\n - A short and direct subject line (under 50 characters) summarizing the specific changes. No formatting should be used in the subject line.\\n - A brief bullet-point list of the exact modifications made, with basic Markdown formatting allowed in the body.\\n - A detailed description in Markdown format explaining the changes, and any additional context that is relevant for the reviewers.\\n \\n Focus strictly on the changes themselves, avoiding any speculation about the reasons or potential impacts.\\n **Do not include any closing statements or generic sentences. End the message immediately after providing the necessary details.**",
"model": "gpt-4o",
"max_tokens": 1000,
"temperature": 0.7
"max_tokens": 2000,
"temperature": 0.6
}

2
ait.py
View File

@@ -64,7 +64,7 @@ def run_git_commands(diff_expression, log_expression):
diff_command = ["git", "diff", diff_expression]
diff_result = subprocess.run(diff_command, capture_output=True, text=True)
log_command = ["git", "log", log_expression, "--pretty=format:%h %s%n%b%n---%n"]
log_command = ["git", "log", log_expression, "--pretty=\"format:%h%n%ad%n%s%n%n%b%n---%n\""]
log_result = subprocess.run(log_command, capture_output=True, text=True)
return diff_result.stdout, log_result.stdout

BIN
docs/ait.webp Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB