mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-17 22:11:59 +03:00
feat: add token for branch_name in custom prompts
This commit is contained in:
parent
97937e242f
commit
99ada05663
@ -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<Result<string, Error>> {
|
||||
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
|
||||
|
@ -89,7 +89,8 @@
|
||||
hunks,
|
||||
useEmojiStyle: $commitGenerationUseEmojis,
|
||||
useBriefStyle: $commitGenerationExtraConcise,
|
||||
commitTemplate: prompt
|
||||
commitTemplate: prompt,
|
||||
branchName: $branch.name
|
||||
});
|
||||
|
||||
if (isFailure(generatedMessageResult)) {
|
||||
|
Loading…
Reference in New Issue
Block a user