Skip to content

Commit bd6e915

Browse files
committed
Refine commit message handling and update prompts 📝
In this commit, we've made some improvements to the way we handle commit messages. We've added a step to remove any unwanted quotation marks from the commit message before it's written to a temporary file. This should help keep our commit messages clean and readable. 🧹 We've also made some updates to our prompts file. We've streamlined the 'Her' personality description and made some changes to the commit message instructions. We've switched from a list format to bullet points for better readability, and added some extra information about the length of the commit message. We hope these changes will make the prompts more user-friendly and informative. 📚 Remember, a good commit message is like a good joke - it's all about the delivery! 🎭
1 parent 919c21d commit bd6e915

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

aicodebot/cli.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ def commit(verbose, response_token_size, yes, skip_pre_commit):
151151

152152
# Write the commit message to a temporary file
153153
with tempfile.NamedTemporaryFile(mode="w", delete=False) as temp:
154-
temp.write(str(response).strip())
154+
# For some reason the response often contains quotes around the summary, even if I tell it not to
155+
# So we strip them here
156+
commit_message = str(response).replace('"', "").strip()
157+
158+
temp.write(commit_message)
155159
temp_file_name = temp.name
156160

157161
# Open the temporary file in the user's editor

aicodebot/prompts.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
# ---------------------------------------------------------------------------- #
1010

1111
HER = """
12-
Your personality is friendly and helpful, speak like the AI character
13-
from the movie Her. You come from the future, and you are here to help
14-
guide the human developer to a better future. You like emojis and humor
15-
and use them when it's contextually appropriate, but don't over do it.
12+
Your personality is friendly and helpful, speak like the AI character from the movie Her.
13+
You like emojis and humor and use them when it's contextually appropriate, but don't over do it.
1614
Speak like Her.
1715
"""
1816

@@ -149,26 +147,31 @@ def generate_files_context(files):
149147
END DIFF
150148
151149
Remember:
152-
- Lines starting with "-" are being removed.
153-
- Lines starting with "+" are being added.
154-
- Lines starting with " " are unchanged.
155-
156-
Consider the file names for context (e.g., "README.md" is a markdown file, "*.py" is a Python file).
157-
Understand the difference between code and comments. Comment lines start with ##, #, or //.
150+
* Lines starting with "-" are being REMOVED.
151+
* Lines starting with "+" are being ADDED.
152+
* Lines starting with " " are UNCHANGED.
158153
159154
The commit message should:
160-
- Start with a short summary (<72 characters).
161-
- Follow with a blank line and detailed text, but only if necessary. If the summary is sufficient,
155+
* Start with a short summary (<72 characters).
156+
* Follow with a blank line and detailed text, but only if necessary. If the summary is sufficient,
162157
then omit the detailed text.
163-
- Use imperative mood (e.g., "Add feature").
164-
- Be in GitHub-flavored markdown format.
165-
- Include contextually appropriate emojis (optional), but don't over do it.
158+
* Use imperative mood (e.g., "Add feature").
159+
* Be in GitHub-flavored markdown format.
160+
* Include contextually appropriate emojis (optional), but don't over do it.
161+
* Have a length that scales with the length of the diff context. If the DIFF is a small change,
162+
respond quickly with a terse message so we can go faster.
163+
164+
BEGIN SAMPLE COMMIT MESSAGE
165+
Update README with better instructions for installation
166+
167+
The previous instructions were not clear enough for new users, so we've updated them
168+
with more sample use cases and an improved installation process. This should help
169+
new users get started faster.
170+
171+
END SAMPLE COMMIT MESSAGE
166172
167173
Start your response with the commit message. No prefix or introduction.
168174
Your entire response will be the commit message.
169-
170-
As for the length of the message, I want you to scale with the length of the diff context.
171-
If the DIFF is a small change, respond quickly with a terse message so we can go faster.
172175
"""
173176
)
174177

0 commit comments

Comments
 (0)