@wu529778790/open-im 1.10.9-beta.15 → 1.10.9-beta.17

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.
@@ -145,7 +145,18 @@ async function fetchApi(path, signal) {
145
145
  },
146
146
  signal,
147
147
  });
148
- return res.json();
148
+ const text = await res.text();
149
+ try {
150
+ const json = JSON.parse(text);
151
+ if (!json.ok) {
152
+ log.warn(`ClawBot API ${path.split('?')[0]} response: ${text.substring(0, 500)}`);
153
+ }
154
+ return json;
155
+ }
156
+ catch {
157
+ log.warn(`ClawBot API non-JSON response (${res.status}): ${text.substring(0, 300)}`);
158
+ return { ok: false, error: `HTTP ${res.status}: non-JSON response` };
159
+ }
149
160
  }
150
161
  function sleep(ms, signal) {
151
162
  return new Promise((resolve) => {
@@ -98,12 +98,12 @@ export async function waitForQRLogin(session, onStatusChange) {
98
98
  if (!result.bot_token) {
99
99
  return { connected: false, message: '登录失败:服务器未返回 bot_token' };
100
100
  }
101
- log.info(`Login confirmed! botId=${result.ilink_bot_id}`);
101
+ log.info(`Login confirmed! botId=${result.ilink_bot_id}, baseurl=${result.baseurl ?? '(empty)'}`);
102
102
  return {
103
103
  connected: true,
104
104
  botToken: result.bot_token,
105
105
  accountId: result.ilink_bot_id,
106
- baseUrl: result.baseurl,
106
+ baseUrl: result.baseurl || ILINK_BASE_URL,
107
107
  userId: result.ilink_user_id,
108
108
  message: '登录成功',
109
109
  };
package/dist/setup.js CHANGED
@@ -607,6 +607,8 @@ export async function runInteractiveSetup() {
607
607
  });
608
608
  if (result.connected && result.botToken) {
609
609
  cbApiToken = result.botToken;
610
+ if (result.baseUrl)
611
+ cbApiUrl = result.baseUrl;
610
612
  console.log("\n✅ 登录成功!");
611
613
  if (result.userId) {
612
614
  console.log(` 用户 ID: ${result.userId}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wu529778790/open-im",
3
- "version": "1.10.9-beta.15",
3
+ "version": "1.10.9-beta.17",
4
4
  "description": "Multi-platform IM bridge for AI CLI tools (Claude, Codex, CodeBuddy)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",