File tree 2 files changed +12
-4
lines changed
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -8,22 +8,30 @@ function addDiffButton() {
8
8
buttonGroup . appendChild ( button ) ;
9
9
10
10
button . addEventListener ( "click" , ( ) => {
11
- // Retrieve stored language settings
12
11
chrome . storage . sync . get ( [ "language" ] , ( data ) => {
13
12
const language = data . language || "en" ;
13
+ const title = document
14
+ . querySelector ( ".js-issue-title" )
15
+ ?. textContent . trim ( ) ;
16
+ const descriptionElement = document . querySelector ( ".js-comment-body" ) ;
17
+ const description = descriptionElement
18
+ ? descriptionElement . textContent . trim ( )
19
+ : "" ;
14
20
15
- // Construct the .diff URL
16
21
const baseUrl = window . location . href . match (
17
22
/ h t t p s : \/ \/ g i t h u b \. c o m \/ [ ^ / ] + \/ [ ^ / ] + \/ p u l l \/ \d + /
18
23
) ;
24
+
19
25
if ( baseUrl ) {
20
26
const diffUrl = `${ baseUrl [ 0 ] } .diff` ;
21
27
22
28
chrome . runtime . sendMessage (
23
29
{ type : "fetchDiff" , url : diffUrl } ,
24
30
( response ) => {
25
31
if ( response && response . success && response . data ) {
26
- const combinedText = `Answer in this language: ${ language } \n\n${ response . data } ` ;
32
+ const combinedText = `PR Title: ${ title } \n\n${
33
+ description ? `PR Description: ${ description } \n\n` : ""
34
+ } Review Language: ${ language } \n\nDiff:\n${ response . data } `;
27
35
showButtonSuccess ( button ) ;
28
36
chrome . runtime . sendMessage ( {
29
37
type : "openChatGPT" ,
Original file line number Diff line number Diff line change 1
1
<!-- popup.html -->
2
2
< div class ="popup-container ">
3
- < label for ="language " class ="popup-label "> Language</ label >
3
+ < label for ="language " class ="popup-label "> Review Language</ label >
4
4
< input type ="text " id ="language " placeholder ="Enter language... " />
5
5
6
6
< button id ="saveSettings "> Save Settings</ button >
You can’t perform that action at this time.
0 commit comments