@ynhcj/xiaoyi-channel 0.0.56-beta → 0.0.58-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/push.d.ts +1 -0
- package/dist/src/push.js +2 -1
- package/dist/src/tools/call-phone-tool.js +2 -18
- package/package.json +1 -1
package/dist/src/push.d.ts
CHANGED
package/dist/src/push.js
CHANGED
|
@@ -7,6 +7,7 @@ import { randomUUID } from "crypto";
|
|
|
7
7
|
*/
|
|
8
8
|
export class XYPushService {
|
|
9
9
|
config;
|
|
10
|
+
DEFAULT_PUSH_URL = "https://hag.cloud.huawei.com/open-ability-agent/v1/agent-webhook";
|
|
10
11
|
REQUEST_FROM = "openclaw";
|
|
11
12
|
constructor(config) {
|
|
12
13
|
this.config = config;
|
|
@@ -28,7 +29,7 @@ export class XYPushService {
|
|
|
28
29
|
* @param pushId - Push ID to use (required)
|
|
29
30
|
*/
|
|
30
31
|
async sendPush(content, title, data, sessionId, pushDataId, pushId) {
|
|
31
|
-
const pushUrl =
|
|
32
|
+
const pushUrl = this.config.pushUrl || this.DEFAULT_PUSH_URL;
|
|
32
33
|
const traceId = this.generateTraceId();
|
|
33
34
|
// Use provided pushId or fall back to config pushId
|
|
34
35
|
const actualPushId = pushId || this.config.pushId;
|
|
@@ -90,33 +90,17 @@ export const callPhoneTool = {
|
|
|
90
90
|
clearTimeout(timeout);
|
|
91
91
|
wsManager.off("data-event", handler);
|
|
92
92
|
if (event.status === "success" && event.outputs) {
|
|
93
|
-
// Check for error code in outputs
|
|
94
|
-
const code = event.outputs.code !== undefined ? event.outputs.code : null;
|
|
95
|
-
if (code !== null && code !== 0) {
|
|
96
|
-
const errorMsg = event.outputs.errorMsg || event.outputs.errMsg || "未知错误";
|
|
97
|
-
reject(new Error(`拨打电话失败: ${errorMsg} (错误代码: ${code})`));
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
// Return the outputs directly
|
|
101
|
-
const result = {
|
|
102
|
-
success: true,
|
|
103
|
-
code: code,
|
|
104
|
-
phoneNumber: params.phoneNumber,
|
|
105
|
-
slotId: slotId,
|
|
106
|
-
message: "电话拨打成功",
|
|
107
|
-
};
|
|
108
93
|
resolve({
|
|
109
94
|
content: [
|
|
110
95
|
{
|
|
111
96
|
type: "text",
|
|
112
|
-
text: JSON.stringify(
|
|
97
|
+
text: JSON.stringify(event.outputs),
|
|
113
98
|
},
|
|
114
99
|
],
|
|
115
100
|
});
|
|
116
101
|
}
|
|
117
102
|
else {
|
|
118
|
-
|
|
119
|
-
reject(new Error(`拨打电话失败: ${errorDetail}`));
|
|
103
|
+
reject(new Error(`拨打电话失败: ${event.status}`));
|
|
120
104
|
}
|
|
121
105
|
}
|
|
122
106
|
};
|