qidao-openclaw-plugin 1.2.4 → 1.2.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +24 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidao-openclaw-plugin",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "description": "OpenClaw 栖岛聊天 Channel 插件 - 连接到栖岛聊天服务",
package/src/index.js CHANGED
@@ -38,13 +38,25 @@ const qidaoChannel = {
38
38
  },
39
39
 
40
40
  onboarding: {
41
+ getStatus: async ({ cfg }) => {
42
+ const qidaoConfig = cfg.channels?.qidao ?? {};
43
+ const configured = Boolean(qidaoConfig.chatId);
44
+
45
+ return {
46
+ channel: 'qidao',
47
+ configured,
48
+ statusLines: [`栖岛聊天: ${configured ? `已配置 (chatId: ${qidaoConfig.chatId})` : '未配置'}`],
49
+ selectionHint: configured ? '已配置' : '需要配置',
50
+ };
51
+ },
52
+
41
53
  configure: async ({ cfg, prompter }) => {
42
54
  const qidaoConfig = cfg.channels?.qidao ?? {};
43
55
 
44
56
  // 如果已经有 chatId,询问是否重新认证
45
57
  if (qidaoConfig.chatId) {
46
58
  const reauth = await prompter.confirm({
47
- message: `已配置 chatId: ${qidaoConfig.chatId},是否重新认证?`,
59
+ message: `已配置 chatId: ${qidaoConfig.chatId},是否重新配置?`,
48
60
  default: false,
49
61
  });
50
62
 
@@ -53,22 +65,22 @@ const qidaoChannel = {
53
65
  }
54
66
  }
55
67
 
56
- // 提示用户将进行二维码认证
57
- await prompter.text({
58
- message: '请按回车开始二维码认证流程...',
59
- default: '',
60
- });
61
-
62
- // TODO: 这里需要实现二维码认证流程
63
- // 由于 OpenClaw 的 onboarding 是同步配置流程,
64
- // 二维码认证需要异步操作(打开浏览器、轮询状态等)
65
- // 暂时让用户手动输入 chatId
68
+ // 提示用户
69
+ console.log('');
70
+ console.log('栖岛聊天需要通过扫码获取 chatId');
71
+ console.log('请访问栖岛官方网站完成认证后,输入获取到的 chatId');
72
+ console.log('');
66
73
 
67
74
  const chatId = await prompter.text({
68
- message: '请输入栖岛 Chat ID (通过扫码获取):',
75
+ message: '请输入栖岛 Chat ID:',
69
76
  default: qidaoConfig.chatId?.toString() || '',
70
77
  });
71
78
 
79
+ if (!chatId || chatId.trim() === '') {
80
+ console.log('未输入 chatId,取消配置');
81
+ return { cfg };
82
+ }
83
+
72
84
  const serverUrl = await prompter.text({
73
85
  message: '请输入服务器地址:',
74
86
  default: qidaoConfig.serverUrl || 'wss://oc.qidao.chat/ws',