Skip to content

Commit e9ee3fc

Browse files
committed
Improves prompts
(#4395, #4430)
1 parent 252ff46 commit e9ee3fc

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/plus/ai/aiProviderService.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,7 @@ export class AIProviderService implements Disposable {
12201220
const errorMessage = `Unable to parse ${options?.generateCommits ? 'commits' : 'rebase'} result`;
12211221
const retryPrompt = dedent(`
12221222
Your previous response could not be parsed as valid JSON. Please ensure your response is a valid JSON array of commits with the correct structure.
1223+
Don't include any preceeding or succeeding text or markup, such as "Here are the commits:" or "Here is a valid JSON array of commits:".
12231224
12241225
Here was your previous response:
12251226
${rq.content}
@@ -1290,7 +1291,8 @@ export class AIProviderService implements Disposable {
12901291
Here was your previous response:
12911292
${rq.content}
12921293
1293-
Please provide the corrected JSON array of commits:
1294+
Please provide the corrected JSON array of commits.
1295+
Don't include any preceeding or succeeding text or markup, such as "Here are the commits:" or "Here is a valid JSON array of commits:".
12941296
`);
12951297

12961298
return {

src/plus/ai/prompts.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,11 @@ Your task is to group the hunks in unified_diff into a set of commits, ordered i
360360
361361
1. Only organize the hunks themselves, not individual lines within hunks.
362362
2. Group hunks into logical units that make sense together and can be applied atomically.
363-
3. Ensure each commit is self-contained and only depends on commits that come before it in the new history.
364-
4. Write meaningful commit messages that accurately describe the changes in each commit.
365-
5. Provide a detailed explanation of the changes in each commit.
366-
6. Make sure the new commit history is easy to review and understand.
363+
3. Use each hunk only once. Use all hunks.
364+
4. Ensure each commit is self-contained and only depends on commits that come before it in the new history.
365+
5. Write meaningful commit messages that accurately describe the changes in each commit.
366+
6. Provide a detailed explanation of the changes in each commit.
367+
7. Make sure the new commit history is easy to review and understand.
367368
368369
Output your new commit history as a JSON array. Each commit in the array should be an object representing a grouping of hunks forming that commit, with the following properties:
369370
- "message": A string containing the commit message.
@@ -394,5 +395,7 @@ Remember to base your organization of commits solely on the provided unified_dif
394395
395396
\${instructions}
396397
397-
Now, proceed with your analysis and organization of the commits. Output only the JSON array containing the commits, and nothing else.`,
398+
Now, proceed with your analysis and organization of the commits. Output only the JSON array containing the commits, and nothing else.
399+
Do not include any preceeding or succeeding text or markup, such as "Here are the commits:" or "Here is a valid JSON array of commits:".
400+
`,
398401
};

0 commit comments

Comments
 (0)