@wu529778790/open-im 1.10.9-beta.16 → 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.
- package/dist/clawbot/client.js +12 -1
- package/dist/setup.js +2 -0
- package/package.json +1 -1
package/dist/clawbot/client.js
CHANGED
|
@@ -145,7 +145,18 @@ async function fetchApi(path, signal) {
|
|
|
145
145
|
},
|
|
146
146
|
signal,
|
|
147
147
|
});
|
|
148
|
-
|
|
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) => {
|
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}`);
|