git_ui: Add support for generating commit messages with an LLM (#26227)
This PR finishes up the support for generating commit messages using an LLM. We're shelling out to `git diff` to get the diff text, as it seemed more efficient than attempting to reconstruct the diff ourselves from our internal Git state. https://github.com/user-attachments/assets/9bcf30a7-7a08-4f49-a753-72a5d954bddd Release Notes: - Git Beta: Added support for generating commit messages using a language model. --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
d1cec209d4
commit
b8a8b9c699
11 changed files with 233 additions and 52 deletions
|
@ -234,7 +234,7 @@ impl CommitModal {
|
|||
pub fn render_footer(&self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
let git_panel = self.git_panel.clone();
|
||||
|
||||
let (branch, can_commit, tooltip, commit_label, co_authors) =
|
||||
let (branch, can_commit, tooltip, commit_label, co_authors, generate_commit_message) =
|
||||
self.git_panel.update(cx, |git_panel, cx| {
|
||||
let branch = git_panel
|
||||
.active_repository
|
||||
|
@ -249,7 +249,15 @@ impl CommitModal {
|
|||
let (can_commit, tooltip) = git_panel.configure_commit_button(cx);
|
||||
let title = git_panel.commit_button_title();
|
||||
let co_authors = git_panel.render_co_authors(cx);
|
||||
(branch, can_commit, tooltip, title, co_authors)
|
||||
let generate_commit_message = git_panel.render_generate_commit_message_button(cx);
|
||||
(
|
||||
branch,
|
||||
can_commit,
|
||||
tooltip,
|
||||
title,
|
||||
co_authors,
|
||||
generate_commit_message,
|
||||
)
|
||||
});
|
||||
|
||||
let branch_picker_button = panel_button(branch)
|
||||
|
@ -316,7 +324,13 @@ impl CommitModal {
|
|||
.w_full()
|
||||
.h(px(self.properties.footer_height))
|
||||
.gap_1()
|
||||
.child(h_flex().gap_1().child(branch_picker).children(co_authors))
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.child(branch_picker)
|
||||
.children(co_authors)
|
||||
.child(generate_commit_message),
|
||||
)
|
||||
.child(div().flex_1())
|
||||
.child(
|
||||
h_flex()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue