Petr Tsvetkov
commited on
Commit
·
e765db8
1
Parent(s):
928b43c
Add AI-generated commit summary; exclude an ill-formated commit
Browse files- app.py +6 -1
- data_loader.py +4 -0
- survey_guide.md +5 -0
app.py
CHANGED
|
@@ -70,13 +70,15 @@ def update_commit_view(sample_ind):
|
|
| 70 |
|
| 71 |
diff_loaded_timestamp = datetime.now().isoformat()
|
| 72 |
|
|
|
|
|
|
|
| 73 |
commit_message = record['prediction']
|
| 74 |
commit_message_start = commit_message
|
| 75 |
commit_message_prev = commit_message
|
| 76 |
commit_message_history = []
|
| 77 |
|
| 78 |
return (
|
| 79 |
-
github_link_md, diff_view, repo_val, hash_val, diff_loaded_timestamp,
|
| 80 |
commit_message_start, commit_message, commit_message_prev, commit_message_history)
|
| 81 |
|
| 82 |
|
|
@@ -118,6 +120,8 @@ with gr.Blocks(theme=gr.themes.Soft(), head=head_html, css="style_overrides.css"
|
|
| 118 |
github_link = gr.Markdown()
|
| 119 |
diff_view = gr.HTML()
|
| 120 |
with gr.Column(scale=1):
|
|
|
|
|
|
|
| 121 |
commit_msg_start = gr.TextArea(label="commit_msg_start", visible=False)
|
| 122 |
commit_msg = gr.TextArea(label="commit_msg_end", show_label=False,
|
| 123 |
info="Commit message (can be scrollable)")
|
|
@@ -143,6 +147,7 @@ with gr.Blocks(theme=gr.themes.Soft(), head=head_html, css="style_overrides.css"
|
|
| 143 |
repo_val,
|
| 144 |
hash_val,
|
| 145 |
sample_loaded_timestamp,
|
|
|
|
| 146 |
commit_msg_start,
|
| 147 |
commit_msg,
|
| 148 |
commit_msg_prev,
|
|
|
|
| 70 |
|
| 71 |
diff_loaded_timestamp = datetime.now().isoformat()
|
| 72 |
|
| 73 |
+
summary_md = f"{record['summary']}"
|
| 74 |
+
|
| 75 |
commit_message = record['prediction']
|
| 76 |
commit_message_start = commit_message
|
| 77 |
commit_message_prev = commit_message
|
| 78 |
commit_message_history = []
|
| 79 |
|
| 80 |
return (
|
| 81 |
+
github_link_md, diff_view, repo_val, hash_val, diff_loaded_timestamp, summary_md,
|
| 82 |
commit_message_start, commit_message, commit_message_prev, commit_message_history)
|
| 83 |
|
| 84 |
|
|
|
|
| 120 |
github_link = gr.Markdown()
|
| 121 |
diff_view = gr.HTML()
|
| 122 |
with gr.Column(scale=1):
|
| 123 |
+
with gr.Accordion("Commit summary (AI generated)", open=False):
|
| 124 |
+
commit_summary = gr.Markdown()
|
| 125 |
commit_msg_start = gr.TextArea(label="commit_msg_start", visible=False)
|
| 126 |
commit_msg = gr.TextArea(label="commit_msg_end", show_label=False,
|
| 127 |
info="Commit message (can be scrollable)")
|
|
|
|
| 147 |
repo_val,
|
| 148 |
hash_val,
|
| 149 |
sample_loaded_timestamp,
|
| 150 |
+
commit_summary,
|
| 151 |
commit_msg_start,
|
| 152 |
commit_msg,
|
| 153 |
commit_msg_prev,
|
data_loader.py
CHANGED
|
@@ -4,6 +4,7 @@ from datasets import load_dataset
|
|
| 4 |
|
| 5 |
CACHE_DIR = 'cache'
|
| 6 |
N_SAMPLES = 15
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
def load_data():
|
|
@@ -12,4 +13,7 @@ def load_data():
|
|
| 12 |
token=os.environ.get('HF_REWRITING_TOKEN'),
|
| 13 |
cache_dir=CACHE_DIR).to_pandas()
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
return df.to_dict('records')[:N_SAMPLES]
|
|
|
|
| 4 |
|
| 5 |
CACHE_DIR = 'cache'
|
| 6 |
N_SAMPLES = 15
|
| 7 |
+
REMOVED_COMMITS = ['9cc896202dc38d962c01aa2637dbc5bbc3e3dd9b']
|
| 8 |
|
| 9 |
|
| 10 |
def load_data():
|
|
|
|
| 13 |
token=os.environ.get('HF_REWRITING_TOKEN'),
|
| 14 |
cache_dir=CACHE_DIR).to_pandas()
|
| 15 |
|
| 16 |
+
removed_idx = df['hash'].isin(REMOVED_COMMITS)
|
| 17 |
+
df = df[~removed_idx]
|
| 18 |
+
|
| 19 |
return df.to_dict('records')[:N_SAMPLES]
|
survey_guide.md
CHANGED
|
@@ -16,5 +16,10 @@ message. Please repeat the process for as many commits
|
|
| 16 |
as you can. If you are stuck on some commit, feel free to skip it
|
| 17 |
using the button on the top right.
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
During the study, we collect all keystrokes made _in a
|
| 20 |
text window_, as well as the resulting message.
|
|
|
|
| 16 |
as you can. If you are stuck on some commit, feel free to skip it
|
| 17 |
using the button on the top right.
|
| 18 |
|
| 19 |
+
We understand that the repositories and the commits we show may be
|
| 20 |
+
unfamiliar to you. In order to help, we used a LLM to generate a
|
| 21 |
+
summary of the commit - you can see the summary by opening the
|
| 22 |
+
dropdown right above the commit message edit field.
|
| 23 |
+
|
| 24 |
During the study, we collect all keystrokes made _in a
|
| 25 |
text window_, as well as the resulting message.
|