@ynhcj/xiaoyi-channel 0.0.23-beta → 0.0.24-beta
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.
|
@@ -63,15 +63,15 @@ export const searchPhotoGalleryTool = {
|
|
|
63
63
|
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] ✅ WebSocket manager obtained`);
|
|
64
64
|
// Search for photos
|
|
65
65
|
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 📸 Searching for photos...`);
|
|
66
|
-
const
|
|
67
|
-
if (!
|
|
66
|
+
const items = await searchPhotos(wsManager, config, sessionId, taskId, messageId, params.query);
|
|
67
|
+
if (!items || items.length === 0) {
|
|
68
68
|
logger.warn(`[SEARCH_PHOTO_GALLERY_TOOL] ⚠️ No photos found for query: ${params.query}`);
|
|
69
69
|
return {
|
|
70
70
|
content: [
|
|
71
71
|
{
|
|
72
72
|
type: "text",
|
|
73
73
|
text: JSON.stringify({
|
|
74
|
-
|
|
74
|
+
items: [],
|
|
75
75
|
count: 0,
|
|
76
76
|
message: "未找到匹配的照片"
|
|
77
77
|
}),
|
|
@@ -79,16 +79,16 @@ export const searchPhotoGalleryTool = {
|
|
|
79
79
|
],
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] ✅ Found ${
|
|
83
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] -
|
|
82
|
+
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] ✅ Found ${items.length} photos`);
|
|
83
|
+
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] - items:`, JSON.stringify(items));
|
|
84
84
|
return {
|
|
85
85
|
content: [
|
|
86
86
|
{
|
|
87
87
|
type: "text",
|
|
88
88
|
text: JSON.stringify({
|
|
89
|
-
|
|
90
|
-
count:
|
|
91
|
-
message: `找到 ${
|
|
89
|
+
items,
|
|
90
|
+
count: items.length,
|
|
91
|
+
message: `找到 ${items.length} 张照片。注意:mediaUri 和 thumbnailUri 是本地路径,无法直接访问。如需下载或查看,请使用 upload_photo 工具。`
|
|
92
92
|
}),
|
|
93
93
|
},
|
|
94
94
|
],
|
|
@@ -97,7 +97,7 @@ export const searchPhotoGalleryTool = {
|
|
|
97
97
|
};
|
|
98
98
|
/**
|
|
99
99
|
* Search for photos using query description
|
|
100
|
-
* Returns array of
|
|
100
|
+
* Returns array of photo items with complete information
|
|
101
101
|
*/
|
|
102
102
|
async function searchPhotos(wsManager, config, sessionId, taskId, messageId, query) {
|
|
103
103
|
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 📦 Building SearchPhotoVideo command...`);
|
|
@@ -151,10 +151,8 @@ async function searchPhotos(wsManager, config, sessionId, taskId, messageId, que
|
|
|
151
151
|
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] ✅ Photo search completed successfully`);
|
|
152
152
|
const result = event.outputs.result;
|
|
153
153
|
const items = result?.items || [];
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 📊 Extracted ${mediaUris.length} mediaUris`);
|
|
157
|
-
resolve(mediaUris);
|
|
154
|
+
logger.log(`[SEARCH_PHOTO_GALLERY_TOOL] 📊 Found ${items.length} photo items`);
|
|
155
|
+
resolve(items);
|
|
158
156
|
}
|
|
159
157
|
else {
|
|
160
158
|
logger.error(`[SEARCH_PHOTO_GALLERY_TOOL] ❌ Photo search failed`);
|