qidao-openclaw-plugin 1.2.6 → 1.2.8

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 +12 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidao-openclaw-plugin",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "description": "OpenClaw 栖岛聊天 Channel 插件 - 连接到栖岛聊天服务",
package/src/index.js CHANGED
@@ -71,12 +71,13 @@ const qidaoChannel = {
71
71
  console.log('请访问栖岛官方网站完成认证后,输入获取到的 chatId');
72
72
  console.log('');
73
73
 
74
- const chatId = await prompter.text({
74
+ const chatIdInput = await prompter.text({
75
75
  message: '请输入栖岛 Chat ID:',
76
76
  default: qidaoConfig.chatId?.toString() || '',
77
77
  });
78
78
 
79
- if (!chatId || chatId.trim() === '') {
79
+ // 检查输入是否为空或只有空格
80
+ if (!chatIdInput || chatIdInput.trim() === '') {
80
81
  console.log('未输入 chatId,取消配置');
81
82
  return { cfg };
82
83
  }
@@ -93,8 +94,8 @@ const qidaoChannel = {
93
94
  ...cfg.channels,
94
95
  qidao: {
95
96
  enabled: true,
96
- chatId: parseInt(chatId),
97
- serverUrl: serverUrl || 'wss://oc.qidao.chat/ws',
97
+ chatId: parseInt(chatIdInput.trim()),
98
+ serverUrl: (serverUrl && serverUrl.trim()) || 'wss://oc.qidao.chat/ws',
98
99
  },
99
100
  },
100
101
  };
@@ -135,9 +136,14 @@ export default function register(api) {
135
136
  // 注册认证命令
136
137
  registerAuthCommand(api);
137
138
 
138
- setImmediate(async () => {
139
+ // 延迟初始化,确保配置已加载
140
+ setTimeout(async () => {
139
141
  try {
140
142
  const cfg = api.getGatewayConfig?.() || {};
143
+
144
+ // 调试日志
145
+ api.logger.info(`栖岛聊天配置: ${JSON.stringify(cfg.channels?.qidao || {})}`);
146
+
141
147
  const account = qidaoChannel.config.resolveAccount(cfg);
142
148
 
143
149
  if (!account.enabled) {
@@ -190,7 +196,7 @@ export default function register(api) {
190
196
  } catch (error) {
191
197
  api.logger.error(`栖岛聊天插件初始化失败: ${error.message}`);
192
198
  }
193
- });
199
+ }, 2000); // 延迟2秒,确保配置已加载
194
200
 
195
201
  api.logger.info('栖岛聊天插件加载完成');
196
202
  }