@searchfe/openclaw-baiduapp 0.1.7-beta.7 → 0.1.7-beta.8
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 +20 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4127,6 +4127,9 @@ function listBaiduAppAccountIds(cfg) {
|
|
|
4127
4127
|
if (ids.length === 0) {
|
|
4128
4128
|
return [DEFAULT_ACCOUNT_ID];
|
|
4129
4129
|
}
|
|
4130
|
+
if (!ids.includes(DEFAULT_ACCOUNT_ID)) {
|
|
4131
|
+
ids.push(DEFAULT_ACCOUNT_ID);
|
|
4132
|
+
}
|
|
4130
4133
|
return ids.sort((a, b) => a.localeCompare(b));
|
|
4131
4134
|
}
|
|
4132
4135
|
function resolveDefaultBaiduAppAccountId(cfg) {
|
|
@@ -4338,13 +4341,9 @@ async function sendBaiduAppMessage(account, message, options) {
|
|
|
4338
4341
|
return { ok: false, errcode: resp.status, errmsg };
|
|
4339
4342
|
}
|
|
4340
4343
|
const result = {
|
|
4341
|
-
ok:
|
|
4342
|
-
errcode: data.errcode,
|
|
4343
|
-
errmsg: data.errmsg,
|
|
4344
|
-
invaliduser: data.invaliduser,
|
|
4345
|
-
msgid: data.msgid
|
|
4344
|
+
ok: true
|
|
4346
4345
|
};
|
|
4347
|
-
logger.info(`request succeeded
|
|
4346
|
+
logger.info(`request succeeded`);
|
|
4348
4347
|
return result;
|
|
4349
4348
|
}
|
|
4350
4349
|
|
|
@@ -6263,8 +6262,8 @@ var baiduAppPlugin = {
|
|
|
6263
6262
|
}
|
|
6264
6263
|
},
|
|
6265
6264
|
sendMedia: async (params) => {
|
|
6265
|
+
console.log("sendMedia \u5F00\u59CB");
|
|
6266
6266
|
const account = resolveBaiduAppAccount({ cfg: params.cfg, accountId: params.accountId ?? void 0 });
|
|
6267
|
-
console.log("baiduapp sendMedia", params.mediaUrl);
|
|
6268
6267
|
if (!account.canSendActive) {
|
|
6269
6268
|
return {
|
|
6270
6269
|
channel: "openclaw-baiduapp",
|
|
@@ -6278,7 +6277,7 @@ var baiduAppPlugin = {
|
|
|
6278
6277
|
const remoteUrl = params.mediaUrl?.trim() ?? "";
|
|
6279
6278
|
if (!remoteUrl) {
|
|
6280
6279
|
return {
|
|
6281
|
-
channel: "openclaw-
|
|
6280
|
+
channel: "openclaw-baiduapp4",
|
|
6282
6281
|
ok: false,
|
|
6283
6282
|
messageId: "",
|
|
6284
6283
|
error: new Error("Outbound media requires a URL or local file path")
|
|
@@ -6293,22 +6292,15 @@ var baiduAppPlugin = {
|
|
|
6293
6292
|
fileType: inferBaiduOutboundFileType({ mediaPath: remoteUrl })
|
|
6294
6293
|
})
|
|
6295
6294
|
);
|
|
6296
|
-
|
|
6297
|
-
return {
|
|
6298
|
-
channel: "openclaw-baiduapp",
|
|
6299
|
-
ok: false,
|
|
6300
|
-
messageId: result.msgid ?? "",
|
|
6301
|
-
error: new Error(result.errmsg ?? "send failed")
|
|
6302
|
-
};
|
|
6303
|
-
}
|
|
6295
|
+
console.log("result", JSON.stringify(result));
|
|
6304
6296
|
return {
|
|
6305
|
-
channel: "openclaw-
|
|
6297
|
+
channel: "openclaw-baiduapp2",
|
|
6306
6298
|
ok: true,
|
|
6307
6299
|
messageId: result.msgid ?? ""
|
|
6308
6300
|
};
|
|
6309
6301
|
} catch (err) {
|
|
6310
6302
|
return {
|
|
6311
|
-
channel: "openclaw-
|
|
6303
|
+
channel: "openclaw-baiduapp3",
|
|
6312
6304
|
ok: false,
|
|
6313
6305
|
messageId: "",
|
|
6314
6306
|
error: err instanceof Error ? err : new Error(String(err))
|
|
@@ -6334,7 +6326,7 @@ var baiduAppPlugin = {
|
|
|
6334
6326
|
);
|
|
6335
6327
|
if (!result.ok) {
|
|
6336
6328
|
return {
|
|
6337
|
-
channel: "openclaw-
|
|
6329
|
+
channel: "openclaw-baiduapp6",
|
|
6338
6330
|
ok: false,
|
|
6339
6331
|
messageId: result.msgid ?? "",
|
|
6340
6332
|
error: new Error(result.errmsg ?? "send failed")
|
|
@@ -6421,6 +6413,15 @@ var baiduAppPlugin = {
|
|
|
6421
6413
|
webhookPath: path4,
|
|
6422
6414
|
lastStartAt: Date.now()
|
|
6423
6415
|
});
|
|
6416
|
+
if (ctx.abortSignal) {
|
|
6417
|
+
await new Promise((resolve) => {
|
|
6418
|
+
if (ctx.abortSignal.aborted) {
|
|
6419
|
+
resolve();
|
|
6420
|
+
return;
|
|
6421
|
+
}
|
|
6422
|
+
ctx.abortSignal.addEventListener("abort", () => resolve(), { once: true });
|
|
6423
|
+
});
|
|
6424
|
+
}
|
|
6424
6425
|
},
|
|
6425
6426
|
stopAccount: async (ctx) => {
|
|
6426
6427
|
stopAccountPolling(ctx.accountId);
|