listpage-next-ai 0.0.277 → 0.0.278
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +8 -4
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -923,17 +923,18 @@ class MetaSo {
|
|
|
923
923
|
q,
|
|
924
924
|
scope,
|
|
925
925
|
includeSummary,
|
|
926
|
-
size,
|
|
927
|
-
page,
|
|
926
|
+
size: String(size),
|
|
927
|
+
page: String(page),
|
|
928
928
|
includeRawContent,
|
|
929
929
|
conciseSnippet
|
|
930
930
|
})
|
|
931
931
|
});
|
|
932
932
|
if (!response.ok) {
|
|
933
933
|
const errorText = await response.text();
|
|
934
|
+
console.error(errorText);
|
|
934
935
|
throw new Error(`秘塔搜索请求失败: ${response.status} ${response.statusText} - ${errorText}`);
|
|
935
936
|
}
|
|
936
|
-
return response.json();
|
|
937
|
+
return await response.json();
|
|
937
938
|
}
|
|
938
939
|
async read(url) {
|
|
939
940
|
const response = await fetch(`${this.baseUrl}/reader`, {
|
|
@@ -967,7 +968,10 @@ function createWebSearchTools(options) {
|
|
|
967
968
|
includeSummary: true,
|
|
968
969
|
size: pageSize
|
|
969
970
|
});
|
|
970
|
-
if (!result.webpages || 0 === result.webpages.length)
|
|
971
|
+
if (!result.webpages || 0 === result.webpages.length) {
|
|
972
|
+
console.log(result);
|
|
973
|
+
return '未找到相关结果。';
|
|
974
|
+
}
|
|
971
975
|
return result.webpages.map((page, index)=>{
|
|
972
976
|
const content = `摘要: ${page.summary || ''}\n内容: ${page.snippet}`;
|
|
973
977
|
return `[结果 ${index + 1}]\n标题: ${page.title}\n链接: ${page.link}\n${content}\n日期: ${page.date}\n`;
|