feat(aiCommitExt): add user-suggested commit-message refinement
This commit is contained in:
+17
-1
@@ -5,6 +5,7 @@ import { output } from "./extension";
|
||||
|
||||
export interface GenerateOptions {
|
||||
model?: string;
|
||||
userSuggestion?: string;
|
||||
}
|
||||
|
||||
let opencodeAvailableCache: boolean | null = null;
|
||||
@@ -47,12 +48,27 @@ export async function generateCommitMessage(
|
||||
const config = vscode.workspace.getConfiguration("aiCommitExt");
|
||||
const model = options.model || config.get<string>("model", "");
|
||||
|
||||
const prompt = `${DEFAULT_PROMPT}
|
||||
let prompt: string;
|
||||
if (options.userSuggestion) {
|
||||
prompt = `The user suggested: "${options.userSuggestion}"
|
||||
|
||||
Improve this commit message to be concise and follow Conventional Commit format.
|
||||
Format: <type>(<scope>): <description>
|
||||
Max 72 characters for the subject line.
|
||||
Types: feat, fix, refactor, docs, style, test, chore, perf, ci, build, revert
|
||||
|
||||
Here are the git changes:
|
||||
${diff}
|
||||
|
||||
Only output the improved commit message, nothing else.`;
|
||||
} else {
|
||||
prompt = `${DEFAULT_PROMPT}
|
||||
|
||||
Here are the git changes:
|
||||
${diff}
|
||||
|
||||
Generate a concise Conventional Commit message for these changes:`;
|
||||
}
|
||||
|
||||
const log = `[${Date.now()}]\r\n${prompt}`;
|
||||
output.appendLine(log);
|
||||
|
||||
Reference in New Issue
Block a user