@@ -199,7 +199,7 @@ async function handleSingleUrl(
199199
200200 const contentRes = await fetch ( `${ baseUrl } /api/content` , {
201201 method : 'POST' ,
202- headers : { 'Content-Type' : 'application/json' } ,
202+ headers : { 'Content-Type' : 'application/json' , ... ( authHeader ? { 'Authorization' : authHeader } : { } ) } ,
203203 body : JSON . stringify ( { urls : [ url ] } ) ,
204204 } ) ;
205205
@@ -270,7 +270,7 @@ async function handleSingleUrl(
270270
271271 const compressRes = await fetch ( `${ baseUrl } /api/compress` , {
272272 method : 'POST' ,
273- headers : { 'Content-Type' : 'application/json' } ,
273+ headers : { 'Content-Type' : 'application/json' , ... ( authHeader ? { 'Authorization' : authHeader } : { } ) } ,
274274 body : JSON . stringify ( {
275275 content : content . text ,
276276 url : content . url || url ,
@@ -457,7 +457,7 @@ async function handleBatchUrls(
457457 // 批量获取内容
458458 const contentRes = await fetch ( `${ baseUrl } /api/content` , {
459459 method : 'POST' ,
460- headers : { 'Content-Type' : 'application/json' } ,
460+ headers : { 'Content-Type' : 'application/json' , ... ( authHeader ? { 'Authorization' : authHeader } : { } ) } ,
461461 body : JSON . stringify ( { urls : uncachedUrls } ) ,
462462 } ) ;
463463
@@ -480,7 +480,7 @@ async function handleBatchUrls(
480480 try {
481481 const compressRes = await fetch ( `${ baseUrl } /api/compress` , {
482482 method : 'POST' ,
483- headers : { 'Content-Type' : 'application/json' } ,
483+ headers : { 'Content-Type' : 'application/json' , ... ( authHeader ? { 'Authorization' : authHeader } : { } ) } ,
484484 body : JSON . stringify ( {
485485 content : content . text ,
486486 url : content . url || url ,
@@ -642,7 +642,7 @@ async function handleQuery(
642642 // Step 1: Exa 外部搜索
643643 const searchRes = await fetch ( `${ baseUrl } /api/search` , {
644644 method : 'POST' ,
645- headers : { 'Content-Type' : 'application/json' } ,
645+ headers : { 'Content-Type' : 'application/json' , ... ( authHeader ? { 'Authorization' : authHeader } : { } ) } ,
646646 body : JSON . stringify ( { query } ) ,
647647 } ) ;
648648
@@ -723,7 +723,7 @@ async function handleQuery(
723723 try {
724724 const compressRes = await fetch ( `${ baseUrl } /api/compress` , {
725725 method : 'POST' ,
726- headers : { 'Content-Type' : 'application/json' } ,
726+ headers : { 'Content-Type' : 'application/json' , ... ( authHeader ? { 'Authorization' : authHeader } : { } ) } ,
727727 body : JSON . stringify ( {
728728 content : result . text ,
729729 url : result . url ,
0 commit comments