@openclaw-china/wecom 0.1.24 → 0.1.26
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 +139 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6024,6 +6024,7 @@ async function configureWecomApp(prompter, cfg) {
|
|
|
6024
6024
|
section("\u914D\u7F6E WeCom App\uFF08\u81EA\u5EFA\u5E94\u7528-\u53EF\u63A5\u5165\u5FAE\u4FE1\uFF09");
|
|
6025
6025
|
showGuideLink("wecom-app");
|
|
6026
6026
|
const existing = getChannelConfig(cfg, "wecom-app");
|
|
6027
|
+
const existingAsr = isRecord(existing.asr) ? existing.asr : {};
|
|
6027
6028
|
const webhookPath = await prompter.askText({
|
|
6028
6029
|
label: "Webhook \u8DEF\u5F84\uFF08\u9700\u4E0E\u4F01\u4E1A\u5FAE\u4FE1\u540E\u53F0\u914D\u7F6E\u4E00\u81F4\uFF0C\u9ED8\u8BA4 /wecom-app\uFF09",
|
|
6029
6030
|
defaultValue: toTrimmedString(existing.webhookPath) ?? "/wecom-app",
|
|
@@ -6062,12 +6063,45 @@ async function configureWecomApp(prompter, cfg) {
|
|
|
6062
6063
|
patch.corpId = corpId;
|
|
6063
6064
|
patch.corpSecret = corpSecret;
|
|
6064
6065
|
patch.agentId = agentId;
|
|
6066
|
+
const asrEnabled = await prompter.askConfirm(
|
|
6067
|
+
"\u542F\u7528 ASR\uFF08\u652F\u6301\u5165\u7AD9\u8BED\u97F3\u81EA\u52A8\u8F6C\u6587\u5B57\uFF09",
|
|
6068
|
+
toBoolean(existingAsr.enabled, false)
|
|
6069
|
+
);
|
|
6070
|
+
const asr = {
|
|
6071
|
+
enabled: asrEnabled
|
|
6072
|
+
};
|
|
6073
|
+
if (asrEnabled) {
|
|
6074
|
+
Ve(
|
|
6075
|
+
[
|
|
6076
|
+
"ASR \u5F00\u901A\u65B9\u5F0F\u8BF7\u67E5\u770B\u914D\u7F6E\u6587\u6863\uFF1A\u6B65\u9AA4\u4E03\uFF08\u53EF\u9009\uFF09\uFF1A\u5F00\u542F\u8BED\u97F3\u8F6C\u6587\u672C\uFF08ASR\uFF09",
|
|
6077
|
+
"https://github.com/BytePioneer-AI/openclaw-china/blob/main/doc/guides/wecom-app/configuration.md"
|
|
6078
|
+
].join("\n"),
|
|
6079
|
+
"\u63D0\u793A"
|
|
6080
|
+
);
|
|
6081
|
+
asr.appId = await prompter.askText({
|
|
6082
|
+
label: "ASR appId\uFF08\u817E\u8BAF\u4E91\uFF09",
|
|
6083
|
+
defaultValue: toTrimmedString(existingAsr.appId),
|
|
6084
|
+
required: true
|
|
6085
|
+
});
|
|
6086
|
+
asr.secretId = await prompter.askSecret({
|
|
6087
|
+
label: "ASR secretId\uFF08\u817E\u8BAF\u4E91\uFF09",
|
|
6088
|
+
existingValue: toTrimmedString(existingAsr.secretId),
|
|
6089
|
+
required: true
|
|
6090
|
+
});
|
|
6091
|
+
asr.secretKey = await prompter.askSecret({
|
|
6092
|
+
label: "ASR secretKey\uFF08\u817E\u8BAF\u4E91\uFF09",
|
|
6093
|
+
existingValue: toTrimmedString(existingAsr.secretKey),
|
|
6094
|
+
required: true
|
|
6095
|
+
});
|
|
6096
|
+
}
|
|
6097
|
+
patch.asr = asr;
|
|
6065
6098
|
return mergeChannelConfig(cfg, "wecom-app", patch);
|
|
6066
6099
|
}
|
|
6067
6100
|
async function configureQQBot(prompter, cfg) {
|
|
6068
6101
|
section("\u914D\u7F6E QQBot\uFF08QQ \u673A\u5668\u4EBA\uFF09");
|
|
6069
6102
|
showGuideLink("qqbot");
|
|
6070
6103
|
const existing = getChannelConfig(cfg, "qqbot");
|
|
6104
|
+
const existingAsr = isRecord(existing.asr) ? existing.asr : {};
|
|
6071
6105
|
const appId = await prompter.askText({
|
|
6072
6106
|
label: "QQBot appId",
|
|
6073
6107
|
defaultValue: toTrimmedString(existing.appId),
|
|
@@ -6078,19 +6112,44 @@ async function configureQQBot(prompter, cfg) {
|
|
|
6078
6112
|
existingValue: toTrimmedString(existing.clientSecret),
|
|
6079
6113
|
required: true
|
|
6080
6114
|
});
|
|
6115
|
+
Ve(
|
|
6116
|
+
"QQ \u7684 Markdown \u4F53\u9A8C\u5F88\u597D\uFF0C\u4F46\u9700\u8981\u5148\u7533\u8BF7\u5F00\u901A\uFF0C\u8BE6\u60C5\u8BF7\u67E5\u770B\u914D\u7F6E\u6587\u6863\u3002",
|
|
6117
|
+
"\u63D0\u793A"
|
|
6118
|
+
);
|
|
6081
6119
|
const markdownSupport = await prompter.askConfirm(
|
|
6082
6120
|
"\u542F\u7528 Markdown \u652F\u6301",
|
|
6083
6121
|
toBoolean(existing.markdownSupport, false)
|
|
6084
6122
|
);
|
|
6085
|
-
const
|
|
6086
|
-
"\
|
|
6087
|
-
toBoolean(
|
|
6123
|
+
const asrEnabled = await prompter.askConfirm(
|
|
6124
|
+
"\u542F\u7528 ASR\uFF08\u652F\u6301\u5165\u7AD9\u8BED\u97F3\u81EA\u52A8\u8F6C\u6587\u5B57\uFF09",
|
|
6125
|
+
toBoolean(existingAsr.enabled, false)
|
|
6088
6126
|
);
|
|
6127
|
+
const asr = {
|
|
6128
|
+
enabled: asrEnabled
|
|
6129
|
+
};
|
|
6130
|
+
if (asrEnabled) {
|
|
6131
|
+
Ve("ASR \u5F00\u901A\u65B9\u5F0F\u8BE6\u60C5\u8BF7\u67E5\u770B\u914D\u7F6E\u6587\u6863\u3002", "\u63D0\u793A");
|
|
6132
|
+
asr.appId = await prompter.askText({
|
|
6133
|
+
label: "ASR appId\uFF08\u817E\u8BAF\u4E91\uFF09",
|
|
6134
|
+
defaultValue: toTrimmedString(existingAsr.appId),
|
|
6135
|
+
required: true
|
|
6136
|
+
});
|
|
6137
|
+
asr.secretId = await prompter.askSecret({
|
|
6138
|
+
label: "ASR secretId\uFF08\u817E\u8BAF\u4E91\uFF09",
|
|
6139
|
+
existingValue: toTrimmedString(existingAsr.secretId),
|
|
6140
|
+
required: true
|
|
6141
|
+
});
|
|
6142
|
+
asr.secretKey = await prompter.askSecret({
|
|
6143
|
+
label: "ASR secretKey\uFF08\u817E\u8BAF\u4E91\uFF09",
|
|
6144
|
+
existingValue: toTrimmedString(existingAsr.secretKey),
|
|
6145
|
+
required: true
|
|
6146
|
+
});
|
|
6147
|
+
}
|
|
6089
6148
|
return mergeChannelConfig(cfg, "qqbot", {
|
|
6090
6149
|
appId,
|
|
6091
6150
|
clientSecret,
|
|
6092
6151
|
markdownSupport,
|
|
6093
|
-
|
|
6152
|
+
asr
|
|
6094
6153
|
});
|
|
6095
6154
|
}
|
|
6096
6155
|
async function configureSingleChannel(channel, prompter, cfg) {
|
|
@@ -6229,6 +6288,81 @@ function registerChinaSetupCli(api, opts) {
|
|
|
6229
6288
|
{ commands: ["china"] }
|
|
6230
6289
|
);
|
|
6231
6290
|
}
|
|
6291
|
+
|
|
6292
|
+
// ../../packages/shared/src/cli/install-hint.ts
|
|
6293
|
+
var PROJECT_REPO2 = "https://github.com/BytePioneer-AI/moltbot-china";
|
|
6294
|
+
var INSTALL_SETUP_COMMAND = "openclaw china setup";
|
|
6295
|
+
var START_GATEWAY_COMMAND = "openclaw gateway --port 18789 --verbose";
|
|
6296
|
+
var ANSI_RESET2 = "\x1B[0m";
|
|
6297
|
+
var ANSI_BOLD = "\x1B[1m";
|
|
6298
|
+
var ANSI_LINK2 = "\x1B[1;4;96m";
|
|
6299
|
+
var ANSI_BORDER2 = "\x1B[92m";
|
|
6300
|
+
var SUPPORTED_CHANNELS = [
|
|
6301
|
+
"dingtalk",
|
|
6302
|
+
"feishu-china",
|
|
6303
|
+
"wecom",
|
|
6304
|
+
"wecom-app",
|
|
6305
|
+
"qqbot"
|
|
6306
|
+
];
|
|
6307
|
+
var CHINA_INSTALL_HINT_SHOWN_KEY = /* @__PURE__ */ Symbol.for("@openclaw-china/china-install-hint-shown");
|
|
6308
|
+
function isRecord2(value) {
|
|
6309
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6310
|
+
}
|
|
6311
|
+
function hasAnyEnabledChinaChannel(config) {
|
|
6312
|
+
if (!isRecord2(config)) {
|
|
6313
|
+
return false;
|
|
6314
|
+
}
|
|
6315
|
+
const channels = config.channels;
|
|
6316
|
+
if (!isRecord2(channels)) {
|
|
6317
|
+
return false;
|
|
6318
|
+
}
|
|
6319
|
+
return SUPPORTED_CHANNELS.some((channelId) => {
|
|
6320
|
+
const channelConfig = channels[channelId];
|
|
6321
|
+
return isRecord2(channelConfig) && channelConfig.enabled === true;
|
|
6322
|
+
});
|
|
6323
|
+
}
|
|
6324
|
+
function hasShownInstallHint() {
|
|
6325
|
+
const root = globalThis;
|
|
6326
|
+
return root[CHINA_INSTALL_HINT_SHOWN_KEY] === true;
|
|
6327
|
+
}
|
|
6328
|
+
function markInstallHintShown() {
|
|
6329
|
+
const root = globalThis;
|
|
6330
|
+
root[CHINA_INSTALL_HINT_SHOWN_KEY] = true;
|
|
6331
|
+
}
|
|
6332
|
+
function showChinaInstallHint(api) {
|
|
6333
|
+
if (hasShownInstallHint() || hasAnyEnabledChinaChannel(api.config)) {
|
|
6334
|
+
return;
|
|
6335
|
+
}
|
|
6336
|
+
markInstallHintShown();
|
|
6337
|
+
const lines = [
|
|
6338
|
+
`${ANSI_BORDER2}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${ANSI_RESET2}`,
|
|
6339
|
+
" OpenClaw China Channels \u5DF2\u5C31\u7EEA!",
|
|
6340
|
+
`${ANSI_BORDER2}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${ANSI_RESET2}`,
|
|
6341
|
+
"",
|
|
6342
|
+
"\u9879\u76EE\u4ED3\u5E93:",
|
|
6343
|
+
` ${ANSI_LINK2}${PROJECT_REPO2}${ANSI_RESET2}`,
|
|
6344
|
+
"",
|
|
6345
|
+
"\u2B50 \u5982\u679C\u8FD9\u4E2A\u9879\u76EE\u5BF9\u4F60\u6709\u5E2E\u52A9\uFF0C\u8BF7\u7ED9\u6211\u4EEC\u4E00\u4E2A Star\uFF01\u2B50",
|
|
6346
|
+
"",
|
|
6347
|
+
"\u4E0B\u4E00\u6B65\uFF08\u914D\u7F6E\u5F15\u5BFC\uFF09:",
|
|
6348
|
+
" 1. \u8FD0\u884C\u4EA4\u4E92\u5F0F\u914D\u7F6E\u5411\u5BFC",
|
|
6349
|
+
` ${ANSI_BOLD}${INSTALL_SETUP_COMMAND}${ANSI_RESET2}`,
|
|
6350
|
+
" 2. \u6309\u63D0\u793A\u586B\u5199\u6E20\u9053\u51ED\u636E\u5E76\u4FDD\u5B58\u914D\u7F6E",
|
|
6351
|
+
" 3. \u542F\u52A8\u7F51\u5173\u5E76\u89C2\u5BDF\u65E5\u5FD7",
|
|
6352
|
+
` ${START_GATEWAY_COMMAND}`
|
|
6353
|
+
];
|
|
6354
|
+
if (api.logger?.info) {
|
|
6355
|
+
for (const line of lines) {
|
|
6356
|
+
api.logger.info(line);
|
|
6357
|
+
}
|
|
6358
|
+
return;
|
|
6359
|
+
}
|
|
6360
|
+
if (api.logger?.warn) {
|
|
6361
|
+
for (const line of lines) {
|
|
6362
|
+
api.logger.warn(line);
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6365
|
+
}
|
|
6232
6366
|
function decodeEncodingAESKey(encodingAESKey) {
|
|
6233
6367
|
const trimmed = encodingAESKey.trim();
|
|
6234
6368
|
if (!trimmed) throw new Error("encodingAESKey missing");
|
|
@@ -8262,6 +8396,7 @@ var plugin = {
|
|
|
8262
8396
|
},
|
|
8263
8397
|
register(api) {
|
|
8264
8398
|
registerChinaSetupCli(api, { channels: ["wecom"] });
|
|
8399
|
+
showChinaInstallHint(api);
|
|
8265
8400
|
if (api.runtime) {
|
|
8266
8401
|
setWecomRuntime(api.runtime);
|
|
8267
8402
|
}
|