@openclaw-china/qqbot 0.1.8 → 0.1.10

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
@@ -6586,6 +6586,7 @@ async function configureWecomApp(prompter, cfg) {
6586
6586
  section("\u914D\u7F6E WeCom App\uFF08\u81EA\u5EFA\u5E94\u7528-\u53EF\u63A5\u5165\u5FAE\u4FE1\uFF09");
6587
6587
  showGuideLink("wecom-app");
6588
6588
  const existing = getChannelConfig(cfg, "wecom-app");
6589
+ const existingAsr = isRecord(existing.asr) ? existing.asr : {};
6589
6590
  const webhookPath = await prompter.askText({
6590
6591
  label: "Webhook \u8DEF\u5F84\uFF08\u9700\u4E0E\u4F01\u4E1A\u5FAE\u4FE1\u540E\u53F0\u914D\u7F6E\u4E00\u81F4\uFF0C\u9ED8\u8BA4 /wecom-app\uFF09",
6591
6592
  defaultValue: toTrimmedString(existing.webhookPath) ?? "/wecom-app",
@@ -6624,12 +6625,45 @@ async function configureWecomApp(prompter, cfg) {
6624
6625
  patch.corpId = corpId;
6625
6626
  patch.corpSecret = corpSecret;
6626
6627
  patch.agentId = agentId;
6628
+ const asrEnabled = await prompter.askConfirm(
6629
+ "\u542F\u7528 ASR\uFF08\u652F\u6301\u5165\u7AD9\u8BED\u97F3\u81EA\u52A8\u8F6C\u6587\u5B57\uFF09",
6630
+ toBoolean(existingAsr.enabled, false)
6631
+ );
6632
+ const asr = {
6633
+ enabled: asrEnabled
6634
+ };
6635
+ if (asrEnabled) {
6636
+ Ve(
6637
+ [
6638
+ "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",
6639
+ "https://github.com/BytePioneer-AI/openclaw-china/blob/main/doc/guides/wecom-app/configuration.md"
6640
+ ].join("\n"),
6641
+ "\u63D0\u793A"
6642
+ );
6643
+ asr.appId = await prompter.askText({
6644
+ label: "ASR appId\uFF08\u817E\u8BAF\u4E91\uFF09",
6645
+ defaultValue: toTrimmedString(existingAsr.appId),
6646
+ required: true
6647
+ });
6648
+ asr.secretId = await prompter.askSecret({
6649
+ label: "ASR secretId\uFF08\u817E\u8BAF\u4E91\uFF09",
6650
+ existingValue: toTrimmedString(existingAsr.secretId),
6651
+ required: true
6652
+ });
6653
+ asr.secretKey = await prompter.askSecret({
6654
+ label: "ASR secretKey\uFF08\u817E\u8BAF\u4E91\uFF09",
6655
+ existingValue: toTrimmedString(existingAsr.secretKey),
6656
+ required: true
6657
+ });
6658
+ }
6659
+ patch.asr = asr;
6627
6660
  return mergeChannelConfig(cfg, "wecom-app", patch);
6628
6661
  }
6629
6662
  async function configureQQBot(prompter, cfg) {
6630
6663
  section("\u914D\u7F6E QQBot\uFF08QQ \u673A\u5668\u4EBA\uFF09");
6631
6664
  showGuideLink("qqbot");
6632
6665
  const existing = getChannelConfig(cfg, "qqbot");
6666
+ const existingAsr = isRecord(existing.asr) ? existing.asr : {};
6633
6667
  const appId = await prompter.askText({
6634
6668
  label: "QQBot appId",
6635
6669
  defaultValue: toTrimmedString(existing.appId),
@@ -6640,19 +6674,44 @@ async function configureQQBot(prompter, cfg) {
6640
6674
  existingValue: toTrimmedString(existing.clientSecret),
6641
6675
  required: true
6642
6676
  });
6677
+ Ve(
6678
+ "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",
6679
+ "\u63D0\u793A"
6680
+ );
6643
6681
  const markdownSupport = await prompter.askConfirm(
6644
6682
  "\u542F\u7528 Markdown \u652F\u6301",
6645
6683
  toBoolean(existing.markdownSupport, false)
6646
6684
  );
6647
- const replyFinalOnly = await prompter.askConfirm(
6648
- "\u4EC5\u53D1\u9001\u6700\u7EC8\u56DE\u590D\uFF08\u5173\u95ED\u6D41\u5F0F\u5206\u7247\uFF09",
6649
- toBoolean(existing.replyFinalOnly, false)
6685
+ const asrEnabled = await prompter.askConfirm(
6686
+ "\u542F\u7528 ASR\uFF08\u652F\u6301\u5165\u7AD9\u8BED\u97F3\u81EA\u52A8\u8F6C\u6587\u5B57\uFF09",
6687
+ toBoolean(existingAsr.enabled, false)
6650
6688
  );
6689
+ const asr = {
6690
+ enabled: asrEnabled
6691
+ };
6692
+ if (asrEnabled) {
6693
+ Ve("ASR \u5F00\u901A\u65B9\u5F0F\u8BE6\u60C5\u8BF7\u67E5\u770B\u914D\u7F6E\u6587\u6863\u3002", "\u63D0\u793A");
6694
+ asr.appId = await prompter.askText({
6695
+ label: "ASR appId\uFF08\u817E\u8BAF\u4E91\uFF09",
6696
+ defaultValue: toTrimmedString(existingAsr.appId),
6697
+ required: true
6698
+ });
6699
+ asr.secretId = await prompter.askSecret({
6700
+ label: "ASR secretId\uFF08\u817E\u8BAF\u4E91\uFF09",
6701
+ existingValue: toTrimmedString(existingAsr.secretId),
6702
+ required: true
6703
+ });
6704
+ asr.secretKey = await prompter.askSecret({
6705
+ label: "ASR secretKey\uFF08\u817E\u8BAF\u4E91\uFF09",
6706
+ existingValue: toTrimmedString(existingAsr.secretKey),
6707
+ required: true
6708
+ });
6709
+ }
6651
6710
  return mergeChannelConfig(cfg, "qqbot", {
6652
6711
  appId,
6653
6712
  clientSecret,
6654
6713
  markdownSupport,
6655
- replyFinalOnly
6714
+ asr
6656
6715
  });
6657
6716
  }
6658
6717
  async function configureSingleChannel(channel, prompter, cfg) {
@@ -6792,6 +6851,81 @@ function registerChinaSetupCli(api, opts) {
6792
6851
  );
6793
6852
  }
6794
6853
 
6854
+ // ../../packages/shared/src/cli/install-hint.ts
6855
+ var PROJECT_REPO2 = "https://github.com/BytePioneer-AI/moltbot-china";
6856
+ var INSTALL_SETUP_COMMAND = "openclaw china setup";
6857
+ var START_GATEWAY_COMMAND = "openclaw gateway --port 18789 --verbose";
6858
+ var ANSI_RESET2 = "\x1B[0m";
6859
+ var ANSI_BOLD = "\x1B[1m";
6860
+ var ANSI_LINK2 = "\x1B[1;4;96m";
6861
+ var ANSI_BORDER2 = "\x1B[92m";
6862
+ var SUPPORTED_CHANNELS = [
6863
+ "dingtalk",
6864
+ "feishu-china",
6865
+ "wecom",
6866
+ "wecom-app",
6867
+ "qqbot"
6868
+ ];
6869
+ var CHINA_INSTALL_HINT_SHOWN_KEY = /* @__PURE__ */ Symbol.for("@openclaw-china/china-install-hint-shown");
6870
+ function isRecord2(value) {
6871
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6872
+ }
6873
+ function hasAnyEnabledChinaChannel(config) {
6874
+ if (!isRecord2(config)) {
6875
+ return false;
6876
+ }
6877
+ const channels = config.channels;
6878
+ if (!isRecord2(channels)) {
6879
+ return false;
6880
+ }
6881
+ return SUPPORTED_CHANNELS.some((channelId) => {
6882
+ const channelConfig = channels[channelId];
6883
+ return isRecord2(channelConfig) && channelConfig.enabled === true;
6884
+ });
6885
+ }
6886
+ function hasShownInstallHint() {
6887
+ const root = globalThis;
6888
+ return root[CHINA_INSTALL_HINT_SHOWN_KEY] === true;
6889
+ }
6890
+ function markInstallHintShown() {
6891
+ const root = globalThis;
6892
+ root[CHINA_INSTALL_HINT_SHOWN_KEY] = true;
6893
+ }
6894
+ function showChinaInstallHint(api) {
6895
+ if (hasShownInstallHint() || hasAnyEnabledChinaChannel(api.config)) {
6896
+ return;
6897
+ }
6898
+ markInstallHintShown();
6899
+ const lines = [
6900
+ `${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}`,
6901
+ " OpenClaw China Channels \u5DF2\u5C31\u7EEA!",
6902
+ `${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}`,
6903
+ "",
6904
+ "\u9879\u76EE\u4ED3\u5E93:",
6905
+ ` ${ANSI_LINK2}${PROJECT_REPO2}${ANSI_RESET2}`,
6906
+ "",
6907
+ "\u2B50 \u5982\u679C\u8FD9\u4E2A\u9879\u76EE\u5BF9\u4F60\u6709\u5E2E\u52A9\uFF0C\u8BF7\u7ED9\u6211\u4EEC\u4E00\u4E2A Star\uFF01\u2B50",
6908
+ "",
6909
+ "\u4E0B\u4E00\u6B65\uFF08\u914D\u7F6E\u5F15\u5BFC\uFF09:",
6910
+ " 1. \u8FD0\u884C\u4EA4\u4E92\u5F0F\u914D\u7F6E\u5411\u5BFC",
6911
+ ` ${ANSI_BOLD}${INSTALL_SETUP_COMMAND}${ANSI_RESET2}`,
6912
+ " 2. \u6309\u63D0\u793A\u586B\u5199\u6E20\u9053\u51ED\u636E\u5E76\u4FDD\u5B58\u914D\u7F6E",
6913
+ " 3. \u542F\u52A8\u7F51\u5173\u5E76\u89C2\u5BDF\u65E5\u5FD7",
6914
+ ` ${START_GATEWAY_COMMAND}`
6915
+ ];
6916
+ if (api.logger?.info) {
6917
+ for (const line of lines) {
6918
+ api.logger.info(line);
6919
+ }
6920
+ return;
6921
+ }
6922
+ if (api.logger?.warn) {
6923
+ for (const line of lines) {
6924
+ api.logger.warn(line);
6925
+ }
6926
+ }
6927
+ }
6928
+
6795
6929
  // src/client.ts
6796
6930
  var API_BASE = "https://api.sgroup.qq.com";
6797
6931
  var TOKEN_URL = "https://bots.qq.com/app/getAppAccessToken";
@@ -8584,6 +8718,7 @@ var plugin = {
8584
8718
  },
8585
8719
  register(api) {
8586
8720
  registerChinaSetupCli(api, { channels: ["qqbot"] });
8721
+ showChinaInstallHint(api);
8587
8722
  if (api.runtime) {
8588
8723
  setQQBotRuntime(api.runtime);
8589
8724
  }