@@ -328,50 +328,50 @@ function handlePDFLink(pdfUrl, domain, sectionTitle, callback) {
328
328
329
329
330
330
331
- function fetchPageHTML ( url , domain , sectionTitle ) {
332
- return new Promise ( ( resolve , reject ) => {
333
- fetch ( url )
334
- . then ( response => {
335
- if ( ! response . ok ) {
336
- throw new Error ( 'The URL you entered could not be found. Please check the URL and try again.' ) ;
337
- }
338
- return response . text ( ) ;
339
- } )
340
- . then ( text => resolve ( text ) )
341
- . catch ( error => {
342
- handleSummaryError ( domain , sectionTitle , error . toString ( ) ) ;
343
- reject ( error ) ;
344
- } ) ;
345
- } ) ;
346
- }
347
-
348
-
349
-
350
331
// function fetchPageHTML(url, domain, sectionTitle) {
351
332
// 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
- // });
333
+ // fetch(url)
334
+ // .then(response => {
335
+ // if (!response.ok) {
336
+ // throw new Error('The URL you entered could not be found. Please check the URL and try again.');
337
+ // }
338
+ // return response.text();
339
+ // })
340
+ // .then(text => resolve(text))
341
+ // .catch(error => {
342
+ // handleSummaryError(domain, sectionTitle, error.toString());
343
+ // reject(error);
344
+ // });
370
345
// });
371
346
// }
372
347
373
348
374
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
375
function summarizeDocument ( document , url , sectionTitle , pageURL ) {
376
376
let domain = url ;
377
377
logMessage ( `Sending summary request for ${ sectionTitle } on ${ domain } ` ) ;
0 commit comments