File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -8,22 +8,30 @@ function addDiffButton() {
88 buttonGroup . appendChild ( button ) ;
99
1010 button . addEventListener ( "click" , ( ) => {
11- // Retrieve stored language settings
1211 chrome . storage . sync . get ( [ "language" ] , ( data ) => {
1312 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+ : "" ;
1420
15- // Construct the .diff URL
1621 const baseUrl = window . location . href . match (
1722 / h t t p s : \/ \/ g i t h u b \. c o m \/ [ ^ / ] + \/ [ ^ / ] + \/ p u l l \/ \d + /
1823 ) ;
24+
1925 if ( baseUrl ) {
2026 const diffUrl = `${ baseUrl [ 0 ] } .diff` ;
2127
2228 chrome . runtime . sendMessage (
2329 { type : "fetchDiff" , url : diffUrl } ,
2430 ( response ) => {
2531 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 } `;
2735 showButtonSuccess ( button ) ;
2836 chrome . runtime . sendMessage ( {
2937 type : "openChatGPT" ,
Original file line number Diff line number Diff line change 11<!-- popup.html -->
22< div class ="popup-container ">
3- < label for ="language " class ="popup-label "> Language</ label >
3+ < label for ="language " class ="popup-label "> Review Language</ label >
44 < input type ="text " id ="language " placeholder ="Enter language... " />
55
66 < button id ="saveSettings "> Save Settings</ button >
You can’t perform that action at this time.
0 commit comments