|
@@ -955,13 +955,18 @@ router.route("/getGraphs2").all(async (req, res, next) => {
|
|
|
|
|
|
// 使用 Promise.all 并通过 map 返回新的 results 数组
|
|
|
let results = await Promise.all(documentIds.map(async documentId => {
|
|
|
- const response = await client.documents.listRelationships({
|
|
|
- id: documentId,
|
|
|
- includeVectors: false,
|
|
|
- offset: 0,
|
|
|
- limit: 1000, // 修正这里的参数
|
|
|
- });
|
|
|
- return response.results;
|
|
|
+ try {
|
|
|
+ const response = await client.documents.listRelationships({
|
|
|
+ id: documentId,
|
|
|
+ includeVectors: false,
|
|
|
+ offset: 0,
|
|
|
+ limit: 1000, // 修正这里的参数
|
|
|
+ });
|
|
|
+ return response.results;
|
|
|
+ } catch (error) {
|
|
|
+ console.error(`Error fetching relationships for documentId ${documentId}:`, error);
|
|
|
+ return []; // 返回空数组
|
|
|
+ }
|
|
|
}));
|
|
|
|
|
|
// 使用 flat() 合并所有数组
|