@ynhcj/xiaoyi-channel 0.0.48-beta → 0.0.50-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/bot.js
CHANGED
|
@@ -165,7 +165,7 @@ export async function handleXYMessage(params) {
|
|
|
165
165
|
sessionId: parsed.sessionId,
|
|
166
166
|
taskId: parsed.taskId,
|
|
167
167
|
messageId: parsed.messageId,
|
|
168
|
-
text: isSecondMessage ? "新消息已接收,正在处理..." : "
|
|
168
|
+
text: isSecondMessage ? "新消息已接收,正在处理..." : "任务正在处理中,请稍候~",
|
|
169
169
|
state: "working",
|
|
170
170
|
}).catch((err) => {
|
|
171
171
|
error(`Failed to send initial status update:`, err);
|
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();
|
|
@@ -54,7 +54,7 @@ export function createXYReplyDispatcher(params) {
|
|
|
54
54
|
sessionId,
|
|
55
55
|
taskId: currentTaskId, // 🔑 动态taskId
|
|
56
56
|
messageId: currentMessageId, // 🔑 动态messageId
|
|
57
|
-
text: "
|
|
57
|
+
text: "任务正在处理中,请稍候~",
|
|
58
58
|
state: "working",
|
|
59
59
|
}).catch((err) => {
|
|
60
60
|
error(`Failed to send status update:`, err);
|
|
@@ -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
|
};
|