@searchfe/openclaw-baiduapp 0.1.7-beta.8 → 0.1.7-beta.9
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/index.js +8 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6233,6 +6233,9 @@ var baiduAppPlugin = {
|
|
|
6233
6233
|
},
|
|
6234
6234
|
outbound: {
|
|
6235
6235
|
deliveryMode: "direct",
|
|
6236
|
+
resolveTarget: (params) => {
|
|
6237
|
+
return { ok: true, to: params.to?.trim() || "default" };
|
|
6238
|
+
},
|
|
6236
6239
|
sendPayload: async (params) => sendBaiduAppPayload(params),
|
|
6237
6240
|
sendText: async (params) => {
|
|
6238
6241
|
const account = resolveBaiduAppAccount({ cfg: params.cfg, accountId: params.accountId });
|
|
@@ -6262,7 +6265,6 @@ var baiduAppPlugin = {
|
|
|
6262
6265
|
}
|
|
6263
6266
|
},
|
|
6264
6267
|
sendMedia: async (params) => {
|
|
6265
|
-
console.log("sendMedia \u5F00\u59CB");
|
|
6266
6268
|
const account = resolveBaiduAppAccount({ cfg: params.cfg, accountId: params.accountId ?? void 0 });
|
|
6267
6269
|
if (!account.canSendActive) {
|
|
6268
6270
|
return {
|
|
@@ -6277,7 +6279,7 @@ var baiduAppPlugin = {
|
|
|
6277
6279
|
const remoteUrl = params.mediaUrl?.trim() ?? "";
|
|
6278
6280
|
if (!remoteUrl) {
|
|
6279
6281
|
return {
|
|
6280
|
-
channel: "openclaw-
|
|
6282
|
+
channel: "openclaw-baiduapp",
|
|
6281
6283
|
ok: false,
|
|
6282
6284
|
messageId: "",
|
|
6283
6285
|
error: new Error("Outbound media requires a URL or local file path")
|
|
@@ -6292,15 +6294,14 @@ var baiduAppPlugin = {
|
|
|
6292
6294
|
fileType: inferBaiduOutboundFileType({ mediaPath: remoteUrl })
|
|
6293
6295
|
})
|
|
6294
6296
|
);
|
|
6295
|
-
console.log("result", JSON.stringify(result));
|
|
6296
6297
|
return {
|
|
6297
|
-
channel: "openclaw-
|
|
6298
|
+
channel: "openclaw-baiduapp",
|
|
6298
6299
|
ok: true,
|
|
6299
6300
|
messageId: result.msgid ?? ""
|
|
6300
6301
|
};
|
|
6301
6302
|
} catch (err) {
|
|
6302
6303
|
return {
|
|
6303
|
-
channel: "openclaw-
|
|
6304
|
+
channel: "openclaw-baiduapp",
|
|
6304
6305
|
ok: false,
|
|
6305
6306
|
messageId: "",
|
|
6306
6307
|
error: err instanceof Error ? err : new Error(String(err))
|
|
@@ -6313,7 +6314,6 @@ var baiduAppPlugin = {
|
|
|
6313
6314
|
filePath: localMediaPath,
|
|
6314
6315
|
contentType: params.mimeType
|
|
6315
6316
|
});
|
|
6316
|
-
console.log("uploaded", JSON.stringify(uploaded));
|
|
6317
6317
|
const result = await sendBaiduAppMessage(
|
|
6318
6318
|
account,
|
|
6319
6319
|
buildOutboundMediaPayload({
|
|
@@ -6324,14 +6324,6 @@ var baiduAppPlugin = {
|
|
|
6324
6324
|
})
|
|
6325
6325
|
})
|
|
6326
6326
|
);
|
|
6327
|
-
if (!result.ok) {
|
|
6328
|
-
return {
|
|
6329
|
-
channel: "openclaw-baiduapp6",
|
|
6330
|
-
ok: false,
|
|
6331
|
-
messageId: result.msgid ?? "",
|
|
6332
|
-
error: new Error(result.errmsg ?? "send failed")
|
|
6333
|
-
};
|
|
6334
|
-
}
|
|
6335
6327
|
return {
|
|
6336
6328
|
channel: "openclaw-baiduapp",
|
|
6337
6329
|
ok: true,
|
|
@@ -6415,11 +6407,11 @@ var baiduAppPlugin = {
|
|
|
6415
6407
|
});
|
|
6416
6408
|
if (ctx.abortSignal) {
|
|
6417
6409
|
await new Promise((resolve) => {
|
|
6418
|
-
if (ctx.abortSignal
|
|
6410
|
+
if (ctx.abortSignal?.aborted) {
|
|
6419
6411
|
resolve();
|
|
6420
6412
|
return;
|
|
6421
6413
|
}
|
|
6422
|
-
ctx.abortSignal
|
|
6414
|
+
ctx.abortSignal?.addEventListener("abort", () => resolve(), { once: true });
|
|
6423
6415
|
});
|
|
6424
6416
|
}
|
|
6425
6417
|
},
|