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.
- package/package.json +1 -1
- package/src/index.js +12 -6
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -71,12 +71,13 @@ const qidaoChannel = {
|
|
|
71
71
|
console.log('请访问栖岛官方网站完成认证后,输入获取到的 chatId');
|
|
72
72
|
console.log('');
|
|
73
73
|
|
|
74
|
-
const
|
|
74
|
+
const chatIdInput = await prompter.text({
|
|
75
75
|
message: '请输入栖岛 Chat ID:',
|
|
76
76
|
default: qidaoConfig.chatId?.toString() || '',
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
}
|