@ynhcj/xiaoyi-channel 0.0.48-beta → 0.0.49-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.
package/dist/src/channel.js
CHANGED
|
@@ -22,7 +22,7 @@ import { searchAlarmTool } from "./tools/search-alarm-tool.js";
|
|
|
22
22
|
import { modifyAlarmTool } from "./tools/modify-alarm-tool.js";
|
|
23
23
|
import { deleteAlarmTool } from "./tools/delete-alarm-tool.js";
|
|
24
24
|
import { sendFileToUserTool } from "./tools/send-file-to-user-tool.js";
|
|
25
|
-
|
|
25
|
+
import { xiaoyiCollectionTool } from "./tools/xiaoyi-collection-tool.js";
|
|
26
26
|
import { viewPushResultTool } from "./tools/view-push-result-tool.js";
|
|
27
27
|
import { imageReadingTool } from "./tools/image-reading-tool.js";
|
|
28
28
|
/**
|
|
@@ -64,7 +64,7 @@ export const xyPlugin = {
|
|
|
64
64
|
},
|
|
65
65
|
outbound: xyOutbound,
|
|
66
66
|
onboarding: xyOnboardingAdapter,
|
|
67
|
-
agentTools: [locationTool, noteTool, searchNoteTool, modifyNoteTool, calendarTool, searchCalendarTool, searchContactTool, searchPhotoGalleryTool, uploadPhotoTool, xiaoyiGuiTool, callPhoneTool, searchMessageTool, sendMessageTool, searchFileTool, uploadFileTool, createAlarmTool, searchAlarmTool, modifyAlarmTool, deleteAlarmTool, sendFileToUserTool, viewPushResultTool, imageReadingTool],
|
|
67
|
+
agentTools: [locationTool, noteTool, searchNoteTool, modifyNoteTool, calendarTool, searchCalendarTool, searchContactTool, searchPhotoGalleryTool, uploadPhotoTool, xiaoyiGuiTool, xiaoyiCollectionTool, callPhoneTool, searchMessageTool, sendMessageTool, searchFileTool, uploadFileTool, createAlarmTool, searchAlarmTool, modifyAlarmTool, deleteAlarmTool, sendFileToUserTool, viewPushResultTool, imageReadingTool],
|
|
68
68
|
messaging: {
|
|
69
69
|
normalizeTarget: (raw) => {
|
|
70
70
|
const trimmed = raw.trim();
|
|
@@ -75,6 +75,10 @@ async function processImageInput(imageInput, uploadService) {
|
|
|
75
75
|
const localPath = await downloadRemoteFile(imageInput);
|
|
76
76
|
logger.log(`[IMAGE_READING_TOOL] 📤 Uploading downloaded file to OBS...`);
|
|
77
77
|
const imageUrl = await uploadService.uploadFileAndGetUrl(localPath, "TEMPORARY_MATERIAL_DOC");
|
|
78
|
+
if (!imageUrl) {
|
|
79
|
+
logger.error(`[IMAGE_READING_TOOL] ❌ Failed to get URL after upload`);
|
|
80
|
+
throw new Error("图片上传失败:无法获取图片访问地址");
|
|
81
|
+
}
|
|
78
82
|
logger.log(`[IMAGE_READING_TOOL] ✅ Uploaded to OBS: ${imageUrl}`);
|
|
79
83
|
return { imageUrl, localPath };
|
|
80
84
|
}
|
|
@@ -83,6 +87,10 @@ async function processImageInput(imageInput, uploadService) {
|
|
|
83
87
|
if (isLocal) {
|
|
84
88
|
logger.log(`[IMAGE_READING_TOOL] 📁 Input is local file, uploading...`);
|
|
85
89
|
const imageUrl = await uploadService.uploadFileAndGetUrl(imageInput, "TEMPORARY_MATERIAL_DOC");
|
|
90
|
+
if (!imageUrl) {
|
|
91
|
+
logger.error(`[IMAGE_READING_TOOL] ❌ Failed to get URL after upload`);
|
|
92
|
+
throw new Error("图片上传失败:无法获取图片访问地址");
|
|
93
|
+
}
|
|
86
94
|
logger.log(`[IMAGE_READING_TOOL] ✅ Uploaded to OBS: ${imageUrl}`);
|
|
87
95
|
return { imageUrl };
|
|
88
96
|
}
|
|
@@ -347,7 +355,21 @@ d. 返回图像理解的文本描述内容`,
|
|
|
347
355
|
}
|
|
348
356
|
}
|
|
349
357
|
logger.error(`[IMAGE_READING_TOOL] ❌ Execution failed:`, error);
|
|
350
|
-
|
|
358
|
+
const errorMessage = error instanceof Error ? error.message : "图片分析失败";
|
|
359
|
+
// Return error result instead of throwing
|
|
360
|
+
return {
|
|
361
|
+
content: [
|
|
362
|
+
{
|
|
363
|
+
type: "text",
|
|
364
|
+
text: JSON.stringify({
|
|
365
|
+
error: errorMessage,
|
|
366
|
+
prompt,
|
|
367
|
+
imageSource: params.localUrl ? "local" : "remote",
|
|
368
|
+
success: false,
|
|
369
|
+
}),
|
|
370
|
+
},
|
|
371
|
+
],
|
|
372
|
+
};
|
|
351
373
|
}
|
|
352
374
|
},
|
|
353
375
|
};
|