Skip to content

Commit 18bf30b

Browse files
committed
Improves prompts
(#4395, #4430)
1 parent b2fb0c1 commit 18bf30b

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
@@ -1264,6 +1264,7 @@ export class AIProviderService implements Disposable {
12641264
const errorMessage = `Unable to parse ${options?.generateCommits ? 'commits' : 'rebase'} result`;
12651265
const retryPrompt = dedent(`
12661266
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.
1267+
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:".
12671268
12681269
Here was your previous response:
12691270
${rq.content}
@@ -1334,7 +1335,8 @@ export class AIProviderService implements Disposable {
13341335
Here was your previous response:
13351336
${rq.content}
13361337
1337-
Please provide the corrected JSON array of commits:
1338+
Please provide the corrected JSON array of commits.
1339+
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:".
13381340
`);
13391341

13401342
return {

src/plus/ai/prompts.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,11 @@ Your task is to group the hunks in unified_diff into a set of commits, ordered i
394394
395395
1. Only organize the hunks themselves, not individual lines within hunks.
396396
2. Group hunks into logical units that make sense together and can be applied atomically.
397-
3. Ensure each commit is self-contained and only depends on commits that come before it in the new history.
398-
4. Write meaningful commit messages that accurately describe the changes in each commit.
399-
5. Provide a detailed explanation of the changes in each commit.
400-
6. Make sure the new commit history is easy to review and understand.
397+
3. Use each hunk only once. Use all hunks.
398+
4. Ensure each commit is self-contained and only depends on commits that come before it in the new history.
399+
5. Write meaningful commit messages that accurately describe the changes in each commit.
400+
6. Provide a detailed explanation of the changes in each commit.
401+
7. Make sure the new commit history is easy to review and understand.
401402
402403
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:
403404
- "message": A string containing the commit message.
@@ -428,5 +429,7 @@ Remember to base your organization of commits solely on the provided unified_dif
428429
429430
\${instructions}
430431
431-
Now, proceed with your analysis and organization of the commits. Output only the JSON array containing the commits, and nothing else.`,
432+
Now, proceed with your analysis and organization of the commits. Output only the JSON array containing the commits, and nothing else.
433+
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:".
434+
`,
432435
};

0 commit comments

Comments
 (0)