@openclaw-china/dingtalk 0.1.35 → 0.1.37

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 CHANGED
@@ -6594,6 +6594,7 @@ async function configureWecomApp(prompter, cfg) {
6594
6594
  section("\u914D\u7F6E WeCom App\uFF08\u81EA\u5EFA\u5E94\u7528-\u53EF\u63A5\u5165\u5FAE\u4FE1\uFF09");
6595
6595
  showGuideLink("wecom-app");
6596
6596
  const existing = getChannelConfig(cfg, "wecom-app");
6597
+ const existingAsr = isRecord(existing.asr) ? existing.asr : {};
6597
6598
  const webhookPath = await prompter.askText({
6598
6599
  label: "Webhook \u8DEF\u5F84\uFF08\u9700\u4E0E\u4F01\u4E1A\u5FAE\u4FE1\u540E\u53F0\u914D\u7F6E\u4E00\u81F4\uFF0C\u9ED8\u8BA4 /wecom-app\uFF09",
6599
6600
  defaultValue: toTrimmedString(existing.webhookPath) ?? "/wecom-app",
@@ -6632,12 +6633,45 @@ async function configureWecomApp(prompter, cfg) {
6632
6633
  patch.corpId = corpId;
6633
6634
  patch.corpSecret = corpSecret;
6634
6635
  patch.agentId = agentId;
6636
+ const asrEnabled = await prompter.askConfirm(
6637
+ "\u542F\u7528 ASR\uFF08\u652F\u6301\u5165\u7AD9\u8BED\u97F3\u81EA\u52A8\u8F6C\u6587\u5B57\uFF09",
6638
+ toBoolean(existingAsr.enabled, false)
6639
+ );
6640
+ const asr = {
6641
+ enabled: asrEnabled
6642
+ };
6643
+ if (asrEnabled) {
6644
+ Ve(
6645
+ [
6646
+ "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",
6647
+ "https://github.com/BytePioneer-AI/openclaw-china/blob/main/doc/guides/wecom-app/configuration.md"
6648
+ ].join("\n"),
6649
+ "\u63D0\u793A"
6650
+ );
6651
+ asr.appId = await prompter.askText({
6652
+ label: "ASR appId\uFF08\u817E\u8BAF\u4E91\uFF09",
6653
+ defaultValue: toTrimmedString(existingAsr.appId),
6654
+ required: true
6655
+ });
6656
+ asr.secretId = await prompter.askSecret({
6657
+ label: "ASR secretId\uFF08\u817E\u8BAF\u4E91\uFF09",
6658
+ existingValue: toTrimmedString(existingAsr.secretId),
6659
+ required: true
6660
+ });
6661
+ asr.secretKey = await prompter.askSecret({
6662
+ label: "ASR secretKey\uFF08\u817E\u8BAF\u4E91\uFF09",
6663
+ existingValue: toTrimmedString(existingAsr.secretKey),
6664
+ required: true
6665
+ });
6666
+ }
6667
+ patch.asr = asr;
6635
6668
  return mergeChannelConfig(cfg, "wecom-app", patch);
6636
6669
  }
6637
6670
  async function configureQQBot(prompter, cfg) {
6638
6671
  section("\u914D\u7F6E QQBot\uFF08QQ \u673A\u5668\u4EBA\uFF09");
6639
6672
  showGuideLink("qqbot");
6640
6673
  const existing = getChannelConfig(cfg, "qqbot");
6674
+ const existingAsr = isRecord(existing.asr) ? existing.asr : {};
6641
6675
  const appId = await prompter.askText({
6642
6676
  label: "QQBot appId",
6643
6677
  defaultValue: toTrimmedString(existing.appId),
@@ -6648,19 +6682,44 @@ async function configureQQBot(prompter, cfg) {
6648
6682
  existingValue: toTrimmedString(existing.clientSecret),
6649
6683
  required: true
6650
6684
  });
6685
+ Ve(
6686
+ "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",
6687
+ "\u63D0\u793A"
6688
+ );
6651
6689
  const markdownSupport = await prompter.askConfirm(
6652
6690
  "\u542F\u7528 Markdown \u652F\u6301",
6653
6691
  toBoolean(existing.markdownSupport, false)
6654
6692
  );
6655
- const replyFinalOnly = await prompter.askConfirm(
6656
- "\u4EC5\u53D1\u9001\u6700\u7EC8\u56DE\u590D\uFF08\u5173\u95ED\u6D41\u5F0F\u5206\u7247\uFF09",
6657
- toBoolean(existing.replyFinalOnly, false)
6693
+ const asrEnabled = await prompter.askConfirm(
6694
+ "\u542F\u7528 ASR\uFF08\u652F\u6301\u5165\u7AD9\u8BED\u97F3\u81EA\u52A8\u8F6C\u6587\u5B57\uFF09",
6695
+ toBoolean(existingAsr.enabled, false)
6658
6696
  );
6697
+ const asr = {
6698
+ enabled: asrEnabled
6699
+ };
6700
+ if (asrEnabled) {
6701
+ Ve("ASR \u5F00\u901A\u65B9\u5F0F\u8BE6\u60C5\u8BF7\u67E5\u770B\u914D\u7F6E\u6587\u6863\u3002", "\u63D0\u793A");
6702
+ asr.appId = await prompter.askText({
6703
+ label: "ASR appId\uFF08\u817E\u8BAF\u4E91\uFF09",
6704
+ defaultValue: toTrimmedString(existingAsr.appId),
6705
+ required: true
6706
+ });
6707
+ asr.secretId = await prompter.askSecret({
6708
+ label: "ASR secretId\uFF08\u817E\u8BAF\u4E91\uFF09",
6709
+ existingValue: toTrimmedString(existingAsr.secretId),
6710
+ required: true
6711
+ });
6712
+ asr.secretKey = await prompter.askSecret({
6713
+ label: "ASR secretKey\uFF08\u817E\u8BAF\u4E91\uFF09",
6714
+ existingValue: toTrimmedString(existingAsr.secretKey),
6715
+ required: true
6716
+ });
6717
+ }
6659
6718
  return mergeChannelConfig(cfg, "qqbot", {
6660
6719
  appId,
6661
6720
  clientSecret,
6662
6721
  markdownSupport,
6663
- replyFinalOnly
6722
+ asr
6664
6723
  });
6665
6724
  }
6666
6725
  async function configureSingleChannel(channel, prompter, cfg) {
@@ -6799,6 +6858,81 @@ function registerChinaSetupCli(api, opts) {
6799
6858
  { commands: ["china"] }
6800
6859
  );
6801
6860
  }
6861
+
6862
+ // ../../packages/shared/src/cli/install-hint.ts
6863
+ var PROJECT_REPO2 = "https://github.com/BytePioneer-AI/moltbot-china";
6864
+ var INSTALL_SETUP_COMMAND = "openclaw china setup";
6865
+ var START_GATEWAY_COMMAND = "openclaw gateway --port 18789 --verbose";
6866
+ var ANSI_RESET2 = "\x1B[0m";
6867
+ var ANSI_BOLD = "\x1B[1m";
6868
+ var ANSI_LINK2 = "\x1B[1;4;96m";
6869
+ var ANSI_BORDER2 = "\x1B[92m";
6870
+ var SUPPORTED_CHANNELS = [
6871
+ "dingtalk",
6872
+ "feishu-china",
6873
+ "wecom",
6874
+ "wecom-app",
6875
+ "qqbot"
6876
+ ];
6877
+ var CHINA_INSTALL_HINT_SHOWN_KEY = /* @__PURE__ */ Symbol.for("@openclaw-china/china-install-hint-shown");
6878
+ function isRecord2(value) {
6879
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6880
+ }
6881
+ function hasAnyEnabledChinaChannel(config) {
6882
+ if (!isRecord2(config)) {
6883
+ return false;
6884
+ }
6885
+ const channels = config.channels;
6886
+ if (!isRecord2(channels)) {
6887
+ return false;
6888
+ }
6889
+ return SUPPORTED_CHANNELS.some((channelId) => {
6890
+ const channelConfig = channels[channelId];
6891
+ return isRecord2(channelConfig) && channelConfig.enabled === true;
6892
+ });
6893
+ }
6894
+ function hasShownInstallHint() {
6895
+ const root = globalThis;
6896
+ return root[CHINA_INSTALL_HINT_SHOWN_KEY] === true;
6897
+ }
6898
+ function markInstallHintShown() {
6899
+ const root = globalThis;
6900
+ root[CHINA_INSTALL_HINT_SHOWN_KEY] = true;
6901
+ }
6902
+ function showChinaInstallHint(api) {
6903
+ if (hasShownInstallHint() || hasAnyEnabledChinaChannel(api.config)) {
6904
+ return;
6905
+ }
6906
+ markInstallHintShown();
6907
+ const lines = [
6908
+ `${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}`,
6909
+ " OpenClaw China Channels \u5DF2\u5C31\u7EEA!",
6910
+ `${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}`,
6911
+ "",
6912
+ "\u9879\u76EE\u4ED3\u5E93:",
6913
+ ` ${ANSI_LINK2}${PROJECT_REPO2}${ANSI_RESET2}`,
6914
+ "",
6915
+ "\u2B50 \u5982\u679C\u8FD9\u4E2A\u9879\u76EE\u5BF9\u4F60\u6709\u5E2E\u52A9\uFF0C\u8BF7\u7ED9\u6211\u4EEC\u4E00\u4E2A Star\uFF01\u2B50",
6916
+ "",
6917
+ "\u4E0B\u4E00\u6B65\uFF08\u914D\u7F6E\u5F15\u5BFC\uFF09:",
6918
+ " 1. \u8FD0\u884C\u4EA4\u4E92\u5F0F\u914D\u7F6E\u5411\u5BFC",
6919
+ ` ${ANSI_BOLD}${INSTALL_SETUP_COMMAND}${ANSI_RESET2}`,
6920
+ " 2. \u6309\u63D0\u793A\u586B\u5199\u6E20\u9053\u51ED\u636E\u5E76\u4FDD\u5B58\u914D\u7F6E",
6921
+ " 3. \u542F\u52A8\u7F51\u5173\u5E76\u89C2\u5BDF\u65E5\u5FD7",
6922
+ ` ${START_GATEWAY_COMMAND}`
6923
+ ];
6924
+ if (api.logger?.info) {
6925
+ for (const line of lines) {
6926
+ api.logger.info(line);
6927
+ }
6928
+ return;
6929
+ }
6930
+ if (api.logger?.warn) {
6931
+ for (const line of lines) {
6932
+ api.logger.warn(line);
6933
+ }
6934
+ }
6935
+ }
6802
6936
  var FileSizeLimitError2 = class _FileSizeLimitError extends Error {
6803
6937
  /** Actual file size in bytes */
6804
6938
  actualSize;
@@ -9734,6 +9868,7 @@ var plugin = {
9734
9868
  */
9735
9869
  register(api) {
9736
9870
  registerChinaSetupCli(api, { channels: ["dingtalk"] });
9871
+ showChinaInstallHint(api);
9737
9872
  if (api.runtime) {
9738
9873
  setDingtalkRuntime(api.runtime);
9739
9874
  }