@@ -104,7 +104,7 @@ chrome.runtime.onMessage.addListener(
104
104
fetchPageHTML ( request . url , domain , sectionTitle ) . then ( pageContent => {
105
105
// Send the content for summarization
106
106
setWaitState ( ) ;
107
- summarizeDocument ( pageContent , domain , sectionTitle )
107
+ summarizeDocument ( pageContent , domain , sectionTitle , request . url )
108
108
. then ( summary => {
109
109
clearWaitState ( ) ;
110
110
logMessage ( `Summary returning for ${ sectionTitle } on ${ domain } ` ) ;
@@ -346,7 +346,33 @@ function fetchPageHTML(url, domain, sectionTitle) {
346
346
}
347
347
348
348
349
- function summarizeDocument ( document , url , sectionTitle ) {
349
+
350
+ // function fetchPageHTML(url, domain, sectionTitle) {
351
+ // return new Promise((resolve, reject) => {
352
+ // fetch('https://docdecoder.app/fetch_html', { // Replace with your Flask server URL
353
+ // method: 'POST',
354
+ // headers: {
355
+ // 'Content-Type': 'application/json'
356
+ // },
357
+ // body: JSON.stringify({ url: url })
358
+ // })
359
+ // .then(response => {
360
+ // if (!response.ok) {
361
+ // throw new Error('Failed to fetch page HTML. Please check the URL and try again.');
362
+ // }
363
+ // return response.text();
364
+ // })
365
+ // .then(text => resolve(text))
366
+ // .catch(error => {
367
+ // handleSummaryError(domain, sectionTitle, error.toString());
368
+ // reject(error);
369
+ // });
370
+ // });
371
+ // }
372
+
373
+
374
+
375
+ function summarizeDocument ( document , url , sectionTitle , pageURL ) {
350
376
let domain = url ;
351
377
logMessage ( `Sending summary request for ${ sectionTitle } on ${ domain } ` ) ;
352
378
@@ -360,7 +386,8 @@ function summarizeDocument(document, url, sectionTitle) {
360
386
body : JSON . stringify ( {
361
387
document : document ,
362
388
domain : domain ,
363
- document_type : sectionTitle
389
+ document_type : sectionTitle ,
390
+ url : pageURL ,
364
391
} ) ,
365
392
} )
366
393
. then ( response => {
0 commit comments