You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(ai-prompt): enhance AI message regeneration logic
Introduces mechanisms to guide the AI in generating distinct commit messages upon user request for regeneration. This prevents the AI from suggesting identical messages for the same staged changes.
- Adds state to `CommitMessageProvider` to store the last generated message and its associated Git context.
- Implements a method to clear this tracking state, ensuring fresh starts when appropriate.
- Modifies the prompt construction to include explicit instructions for the AI to produce a novel message when a previous one for the same context exists.
- Includes new unit tests to validate the system's ability to prompt for different messages and to confirm the tracking reset functionality.
return`${basePrompt}${rulesSection}\n\nReturn ONLY the commit message in the conventional format, nothing else.`
235
+
// Add a final reminder if we need a different message
236
+
constfinalReminder=shouldGenerateDifferentMessage
237
+
? `\n\nFINAL REMINDER: Your message MUST be COMPLETELY DIFFERENT from the previous message: "${this.previousCommitMessage}". This is a critical requirement.`
238
+
: ""
239
+
240
+
return`${basePrompt}${rulesSection}${finalReminder}\n\nReturn ONLY the commit message in the conventional format, nothing else.`
0 commit comments