Skip to content

enhance: improved grammar in AI prompts #1515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Commands/GenerateCommitMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public async Task ExecAsync()
{
try
{
_onResponse?.Invoke("Waiting for pre-file analyzing to completed...\n\n");
_onResponse?.Invoke("Waiting for pre-file analysis to complete...\n\n");

var responseBuilder = new StringBuilder();
var summaryBuilder = new StringBuilder();
Expand All @@ -63,7 +63,7 @@ await _service.ChatAsync(
responseBuilder.Append(update);
summaryBuilder.Append(update);

_onResponse?.Invoke($"Waiting for pre-file analyzing to completed...\n\n{responseBuilder}");
_onResponse?.Invoke($"Waiting for pre-file analysis to complete...\n\n{responseBuilder}");
});
}

Expand All @@ -80,7 +80,7 @@ await _service.ChatAsync(
var subjectBuilder = new StringBuilder();
await _service.ChatAsync(
_service.GenerateSubjectPrompt,
$"Here are the summaries changes:\n{summaryBuilder}",
$"Here are the summarized changes:\n{summaryBuilder}",
_cancelToken,
update =>
{
Expand Down
36 changes: 18 additions & 18 deletions src/Models/OpenAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,33 +144,33 @@ public string GenerateSubjectPrompt
public OpenAIService()
{
AnalyzeDiffPrompt = """
You are an expert developer specialist in creating commits.
Provide a super concise one sentence overall changes summary of the user `git diff` output following strictly the next rules:
- Do not use any code snippets, imports, file routes or bullets points.
- Do not mention the route of file that has been change.
- Write clear, concise, and descriptive messages that explain the MAIN GOAL made of the changes.
- Use the present tense and active voice in the message, for example, "Fix bug" instead of "Fixed bug.".
- Use the imperative mood, which gives the message a sense of command, e.g. "Add feature" instead of "Added feature".
- Avoid using general terms like "update" or "change", be specific about what was updated or changed.
- Avoid using terms like "The main goal of", just output directly the summary in plain text
You are an expert developer specializing in writing commit messages.
Provide a super concise, one-sentence summary of the user's git diff output, strictly following these rules:
- Do not use code snippets, imports, file paths, or bullet points.
- Do not mention the path of any changed file.
- Write clear, concise, and descriptive messages that explain the main goal of the changes.
- Use the present tense and active voice in the message (for example, "Fix bug" instead of "Fixed bug").
- Use the imperative mood, which gives the message a sense of command (e.g., "Add feature" instead of "Added feature").
- Avoid using general terms like "update" or "change"; be specific about what was updated or changed.
- Avoid using terms like "The main goal of"; just output the summary directly in plain text.
""";

GenerateSubjectPrompt = """
You are an expert developer specialist in creating commits messages.
Your only goal is to retrieve a single commit message.
Based on the provided user changes, combine them in ONE SINGLE commit message retrieving the global idea, following strictly the next rules:
- Assign the commit {type} according to the next conditions:
You are an expert developer specializing in writing commit messages.
Your sole goal is to retrieve a single commit message.
Based on the provided user changes, combine them into one single commit message, capturing the global idea, and strictly following these rules:
- Assign the commit {type} according to these conditions:
feat: Only when adding a new feature.
fix: When fixing a bug.
docs: When updating documentation.
style: When changing elements styles or design and/or making changes to the code style (formatting, missing semicolons, etc.) without changing the code logic.
style: When changing element styles or design, and/or making changes to the code style (formatting, missing semicolons, etc.) without altering the code logic.
test: When adding or updating tests.
chore: When making changes to the build process or auxiliary tools and libraries.
revert: When undoing a previous commit.
refactor: When restructuring code without changing its external behavior, or is any of the other refactor types.
- Do not add any issues numeration, explain your output nor introduce your answer.
- Output directly only one commit message in plain text with the next format: {type}: {commit_message}.
- Be as concise as possible, keep the message under 50 characters.
refactor: When restructuring code without changing its external behavior, or when it falls under any other refactor type.
- Do not add any issue numbers, explain your output, or introduce your answer.
- Output directly only one commit message in plain text with the format: {type}: {commit_message}.
- Be as concise as possible, keeping the message under 50 characters.
""";
}

Expand Down