@openclaw-china/wecom-app 0.1.11 → 0.1.13
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
|
@@ -5961,6 +5961,7 @@ async function configureWecomApp(prompter, cfg) {
|
|
|
5961
5961
|
section("\u914D\u7F6E WeCom App\uFF08\u81EA\u5EFA\u5E94\u7528-\u53EF\u63A5\u5165\u5FAE\u4FE1\uFF09");
|
|
5962
5962
|
showGuideLink("wecom-app");
|
|
5963
5963
|
const existing = getChannelConfig(cfg, "wecom-app");
|
|
5964
|
+
const existingAsr = isRecord(existing.asr) ? existing.asr : {};
|
|
5964
5965
|
const webhookPath = await prompter.askText({
|
|
5965
5966
|
label: "Webhook \u8DEF\u5F84\uFF08\u9700\u4E0E\u4F01\u4E1A\u5FAE\u4FE1\u540E\u53F0\u914D\u7F6E\u4E00\u81F4\uFF0C\u9ED8\u8BA4 /wecom-app\uFF09",
|
|
5966
5967
|
defaultValue: toTrimmedString(existing.webhookPath) ?? "/wecom-app",
|
|
@@ -5999,12 +6000,45 @@ async function configureWecomApp(prompter, cfg) {
|
|
|
5999
6000
|
patch.corpId = corpId;
|
|
6000
6001
|
patch.corpSecret = corpSecret;
|
|
6001
6002
|
patch.agentId = agentId;
|
|
6003
|
+
const asrEnabled = await prompter.askConfirm(
|
|
6004
|
+
"\u542F\u7528 ASR\uFF08\u652F\u6301\u5165\u7AD9\u8BED\u97F3\u81EA\u52A8\u8F6C\u6587\u5B57\uFF09",
|
|
6005
|
+
toBoolean(existingAsr.enabled, false)
|
|
6006
|
+
);
|
|
6007
|
+
const asr = {
|
|
6008
|
+
enabled: asrEnabled
|
|
6009
|
+
};
|
|
6010
|
+
if (asrEnabled) {
|
|
6011
|
+
Ve(
|
|
6012
|
+
[
|
|
6013
|
+
"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",
|
|
6014
|
+
"https://github.com/BytePioneer-AI/openclaw-china/blob/main/doc/guides/wecom-app/configuration.md"
|
|
6015
|
+
].join("\n"),
|
|
6016
|
+
"\u63D0\u793A"
|
|
6017
|
+
);
|
|
6018
|
+
asr.appId = await prompter.askText({
|
|
6019
|
+
label: "ASR appId\uFF08\u817E\u8BAF\u4E91\uFF09",
|
|
6020
|
+
defaultValue: toTrimmedString(existingAsr.appId),
|
|
6021
|
+
required: true
|
|
6022
|
+
});
|
|
6023
|
+
asr.secretId = await prompter.askSecret({
|
|
6024
|
+
label: "ASR secretId\uFF08\u817E\u8BAF\u4E91\uFF09",
|
|
6025
|
+
existingValue: toTrimmedString(existingAsr.secretId),
|
|
6026
|
+
required: true
|
|
6027
|
+
});
|
|
6028
|
+
asr.secretKey = await prompter.askSecret({
|
|
6029
|
+
label: "ASR secretKey\uFF08\u817E\u8BAF\u4E91\uFF09",
|
|
6030
|
+
existingValue: toTrimmedString(existingAsr.secretKey),
|
|
6031
|
+
required: true
|
|
6032
|
+
});
|
|
6033
|
+
}
|
|
6034
|
+
patch.asr = asr;
|
|
6002
6035
|
return mergeChannelConfig(cfg, "wecom-app", patch);
|
|
6003
6036
|
}
|
|
6004
6037
|
async function configureQQBot(prompter, cfg) {
|
|
6005
6038
|
section("\u914D\u7F6E QQBot\uFF08QQ \u673A\u5668\u4EBA\uFF09");
|
|
6006
6039
|
showGuideLink("qqbot");
|
|
6007
6040
|
const existing = getChannelConfig(cfg, "qqbot");
|
|
6041
|
+
const existingAsr = isRecord(existing.asr) ? existing.asr : {};
|
|
6008
6042
|
const appId = await prompter.askText({
|
|
6009
6043
|
label: "QQBot appId",
|
|
6010
6044
|
defaultValue: toTrimmedString(existing.appId),
|
|
@@ -6015,19 +6049,44 @@ async function configureQQBot(prompter, cfg) {
|
|
|
6015
6049
|
existingValue: toTrimmedString(existing.clientSecret),
|
|
6016
6050
|
required: true
|
|
6017
6051
|
});
|
|
6052
|
+
Ve(
|
|
6053
|
+
"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",
|
|
6054
|
+
"\u63D0\u793A"
|
|
6055
|
+
);
|
|
6018
6056
|
const markdownSupport = await prompter.askConfirm(
|
|
6019
6057
|
"\u542F\u7528 Markdown \u652F\u6301",
|
|
6020
6058
|
toBoolean(existing.markdownSupport, false)
|
|
6021
6059
|
);
|
|
6022
|
-
const
|
|
6023
|
-
"\
|
|
6024
|
-
toBoolean(
|
|
6060
|
+
const asrEnabled = await prompter.askConfirm(
|
|
6061
|
+
"\u542F\u7528 ASR\uFF08\u652F\u6301\u5165\u7AD9\u8BED\u97F3\u81EA\u52A8\u8F6C\u6587\u5B57\uFF09",
|
|
6062
|
+
toBoolean(existingAsr.enabled, false)
|
|
6025
6063
|
);
|
|
6064
|
+
const asr = {
|
|
6065
|
+
enabled: asrEnabled
|
|
6066
|
+
};
|
|
6067
|
+
if (asrEnabled) {
|
|
6068
|
+
Ve("ASR \u5F00\u901A\u65B9\u5F0F\u8BE6\u60C5\u8BF7\u67E5\u770B\u914D\u7F6E\u6587\u6863\u3002", "\u63D0\u793A");
|
|
6069
|
+
asr.appId = await prompter.askText({
|
|
6070
|
+
label: "ASR appId\uFF08\u817E\u8BAF\u4E91\uFF09",
|
|
6071
|
+
defaultValue: toTrimmedString(existingAsr.appId),
|
|
6072
|
+
required: true
|
|
6073
|
+
});
|
|
6074
|
+
asr.secretId = await prompter.askSecret({
|
|
6075
|
+
label: "ASR secretId\uFF08\u817E\u8BAF\u4E91\uFF09",
|
|
6076
|
+
existingValue: toTrimmedString(existingAsr.secretId),
|
|
6077
|
+
required: true
|
|
6078
|
+
});
|
|
6079
|
+
asr.secretKey = await prompter.askSecret({
|
|
6080
|
+
label: "ASR secretKey\uFF08\u817E\u8BAF\u4E91\uFF09",
|
|
6081
|
+
existingValue: toTrimmedString(existingAsr.secretKey),
|
|
6082
|
+
required: true
|
|
6083
|
+
});
|
|
6084
|
+
}
|
|
6026
6085
|
return mergeChannelConfig(cfg, "qqbot", {
|
|
6027
6086
|
appId,
|
|
6028
6087
|
clientSecret,
|
|
6029
6088
|
markdownSupport,
|
|
6030
|
-
|
|
6089
|
+
asr
|
|
6031
6090
|
});
|
|
6032
6091
|
}
|
|
6033
6092
|
async function configureSingleChannel(channel, prompter, cfg) {
|
|
@@ -6166,6 +6225,81 @@ function registerChinaSetupCli(api, opts) {
|
|
|
6166
6225
|
{ commands: ["china"] }
|
|
6167
6226
|
);
|
|
6168
6227
|
}
|
|
6228
|
+
|
|
6229
|
+
// ../../packages/shared/src/cli/install-hint.ts
|
|
6230
|
+
var PROJECT_REPO2 = "https://github.com/BytePioneer-AI/moltbot-china";
|
|
6231
|
+
var INSTALL_SETUP_COMMAND = "openclaw china setup";
|
|
6232
|
+
var START_GATEWAY_COMMAND = "openclaw gateway --port 18789 --verbose";
|
|
6233
|
+
var ANSI_RESET2 = "\x1B[0m";
|
|
6234
|
+
var ANSI_BOLD = "\x1B[1m";
|
|
6235
|
+
var ANSI_LINK2 = "\x1B[1;4;96m";
|
|
6236
|
+
var ANSI_BORDER2 = "\x1B[92m";
|
|
6237
|
+
var SUPPORTED_CHANNELS = [
|
|
6238
|
+
"dingtalk",
|
|
6239
|
+
"feishu-china",
|
|
6240
|
+
"wecom",
|
|
6241
|
+
"wecom-app",
|
|
6242
|
+
"qqbot"
|
|
6243
|
+
];
|
|
6244
|
+
var CHINA_INSTALL_HINT_SHOWN_KEY = /* @__PURE__ */ Symbol.for("@openclaw-china/china-install-hint-shown");
|
|
6245
|
+
function isRecord2(value) {
|
|
6246
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6247
|
+
}
|
|
6248
|
+
function hasAnyEnabledChinaChannel(config) {
|
|
6249
|
+
if (!isRecord2(config)) {
|
|
6250
|
+
return false;
|
|
6251
|
+
}
|
|
6252
|
+
const channels = config.channels;
|
|
6253
|
+
if (!isRecord2(channels)) {
|
|
6254
|
+
return false;
|
|
6255
|
+
}
|
|
6256
|
+
return SUPPORTED_CHANNELS.some((channelId) => {
|
|
6257
|
+
const channelConfig = channels[channelId];
|
|
6258
|
+
return isRecord2(channelConfig) && channelConfig.enabled === true;
|
|
6259
|
+
});
|
|
6260
|
+
}
|
|
6261
|
+
function hasShownInstallHint() {
|
|
6262
|
+
const root = globalThis;
|
|
6263
|
+
return root[CHINA_INSTALL_HINT_SHOWN_KEY] === true;
|
|
6264
|
+
}
|
|
6265
|
+
function markInstallHintShown() {
|
|
6266
|
+
const root = globalThis;
|
|
6267
|
+
root[CHINA_INSTALL_HINT_SHOWN_KEY] = true;
|
|
6268
|
+
}
|
|
6269
|
+
function showChinaInstallHint(api) {
|
|
6270
|
+
if (hasShownInstallHint() || hasAnyEnabledChinaChannel(api.config)) {
|
|
6271
|
+
return;
|
|
6272
|
+
}
|
|
6273
|
+
markInstallHintShown();
|
|
6274
|
+
const lines = [
|
|
6275
|
+
`${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}`,
|
|
6276
|
+
" OpenClaw China Channels \u5DF2\u5C31\u7EEA!",
|
|
6277
|
+
`${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}`,
|
|
6278
|
+
"",
|
|
6279
|
+
"\u9879\u76EE\u4ED3\u5E93:",
|
|
6280
|
+
` ${ANSI_LINK2}${PROJECT_REPO2}${ANSI_RESET2}`,
|
|
6281
|
+
"",
|
|
6282
|
+
"\u2B50 \u5982\u679C\u8FD9\u4E2A\u9879\u76EE\u5BF9\u4F60\u6709\u5E2E\u52A9\uFF0C\u8BF7\u7ED9\u6211\u4EEC\u4E00\u4E2A Star\uFF01\u2B50",
|
|
6283
|
+
"",
|
|
6284
|
+
"\u4E0B\u4E00\u6B65\uFF08\u914D\u7F6E\u5F15\u5BFC\uFF09:",
|
|
6285
|
+
" 1. \u8FD0\u884C\u4EA4\u4E92\u5F0F\u914D\u7F6E\u5411\u5BFC",
|
|
6286
|
+
` ${ANSI_BOLD}${INSTALL_SETUP_COMMAND}${ANSI_RESET2}`,
|
|
6287
|
+
" 2. \u6309\u63D0\u793A\u586B\u5199\u6E20\u9053\u51ED\u636E\u5E76\u4FDD\u5B58\u914D\u7F6E",
|
|
6288
|
+
" 3. \u542F\u52A8\u7F51\u5173\u5E76\u89C2\u5BDF\u65E5\u5FD7",
|
|
6289
|
+
` ${START_GATEWAY_COMMAND}`
|
|
6290
|
+
];
|
|
6291
|
+
if (api.logger?.info) {
|
|
6292
|
+
for (const line of lines) {
|
|
6293
|
+
api.logger.info(line);
|
|
6294
|
+
}
|
|
6295
|
+
return;
|
|
6296
|
+
}
|
|
6297
|
+
if (api.logger?.warn) {
|
|
6298
|
+
for (const line of lines) {
|
|
6299
|
+
api.logger.warn(line);
|
|
6300
|
+
}
|
|
6301
|
+
}
|
|
6302
|
+
}
|
|
6169
6303
|
function decodeEncodingAESKey(encodingAESKey) {
|
|
6170
6304
|
const trimmed = encodingAESKey.trim();
|
|
6171
6305
|
if (!trimmed) throw new Error("encodingAESKey missing");
|
|
@@ -8779,6 +8913,7 @@ var plugin = {
|
|
|
8779
8913
|
},
|
|
8780
8914
|
register(api) {
|
|
8781
8915
|
registerChinaSetupCli(api, { channels: ["wecom-app"] });
|
|
8916
|
+
showChinaInstallHint(api);
|
|
8782
8917
|
if (api.runtime) {
|
|
8783
8918
|
setWecomAppRuntime(api.runtime);
|
|
8784
8919
|
}
|