diff --git a/apps/desktop/src/lib/ai/service.ts b/apps/desktop/src/lib/ai/service.ts index 6fe256f94..4a84a1c07 100644 --- a/apps/desktop/src/lib/ai/service.ts +++ b/apps/desktop/src/lib/ai/service.ts @@ -58,6 +58,7 @@ interface SummarizeCommitOpts extends BaseAIServiceOpts { useEmojiStyle?: boolean; useBriefStyle?: boolean; commitTemplate?: Prompt; + branchName?: string; } interface SummarizeBranchOpts extends BaseAIServiceOpts { @@ -267,7 +268,8 @@ export class AIService { useEmojiStyle = false, useBriefStyle = false, commitTemplate, - onToken + onToken, + branchName }: SummarizeCommitOpts): Promise> { const aiClientResult = await this.buildClient(); if (isFailure(aiClientResult)) return aiClientResult; @@ -293,6 +295,10 @@ export class AIService { : "Don't use any emoji."; content = content.replaceAll('%{emoji_style}', emojiPart); + if (branchName) { + content = content.replaceAll('%{branch_name}', branchName); + } + return { role: MessageRole.User, content diff --git a/apps/desktop/src/lib/commit/CommitMessageInput.svelte b/apps/desktop/src/lib/commit/CommitMessageInput.svelte index 04aeadb9f..91ea0db54 100644 --- a/apps/desktop/src/lib/commit/CommitMessageInput.svelte +++ b/apps/desktop/src/lib/commit/CommitMessageInput.svelte @@ -89,7 +89,8 @@ hunks, useEmojiStyle: $commitGenerationUseEmojis, useBriefStyle: $commitGenerationExtraConcise, - commitTemplate: prompt + commitTemplate: prompt, + branchName: $branch.name }); if (isFailure(generatedMessageResult)) {