claude-b 0.4.0 → 0.4.2
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/daemon/index.js +15 -10
- package/package.json +1 -1
package/dist/daemon/index.js
CHANGED
|
@@ -1448,13 +1448,16 @@ var RemoteClient = class extends EventEmitter2 {
|
|
|
1448
1448
|
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
1449
1449
|
try {
|
|
1450
1450
|
const start = Date.now();
|
|
1451
|
+
const headers = {
|
|
1452
|
+
"Authorization": `Bearer ${token}`
|
|
1453
|
+
};
|
|
1454
|
+
if (body !== void 0) {
|
|
1455
|
+
headers["Content-Type"] = "application/json";
|
|
1456
|
+
}
|
|
1451
1457
|
const response = await fetch(`${this.host.url}${path}`, {
|
|
1452
1458
|
method,
|
|
1453
|
-
headers
|
|
1454
|
-
|
|
1455
|
-
"Content-Type": "application/json"
|
|
1456
|
-
},
|
|
1457
|
-
body: body ? JSON.stringify(body) : void 0,
|
|
1459
|
+
headers,
|
|
1460
|
+
body: body !== void 0 ? JSON.stringify(body) : void 0,
|
|
1458
1461
|
signal: controller.signal
|
|
1459
1462
|
});
|
|
1460
1463
|
const latency = Date.now() - start;
|
|
@@ -1499,9 +1502,9 @@ var RemoteClient = class extends EventEmitter2 {
|
|
|
1499
1502
|
const result = await this.request(
|
|
1500
1503
|
"POST",
|
|
1501
1504
|
"/api/sessions",
|
|
1502
|
-
name ? { name } :
|
|
1505
|
+
name ? { name } : {}
|
|
1503
1506
|
);
|
|
1504
|
-
return { ...result
|
|
1507
|
+
return { ...result, host: this.host.id };
|
|
1505
1508
|
}
|
|
1506
1509
|
async getSession(sessionId) {
|
|
1507
1510
|
try {
|
|
@@ -1509,7 +1512,7 @@ var RemoteClient = class extends EventEmitter2 {
|
|
|
1509
1512
|
"GET",
|
|
1510
1513
|
`/api/sessions/${sessionId}`
|
|
1511
1514
|
);
|
|
1512
|
-
return { ...result
|
|
1515
|
+
return { ...result, host: this.host.id };
|
|
1513
1516
|
} catch {
|
|
1514
1517
|
return null;
|
|
1515
1518
|
}
|
|
@@ -2263,9 +2266,11 @@ var FailoverHandler = class extends EventEmitter5 {
|
|
|
2263
2266
|
selectHosts(preferredHost, excludeHosts) {
|
|
2264
2267
|
let hosts = this.clientManager.getHealthyHosts().filter((h) => !excludeHosts?.includes(h.id));
|
|
2265
2268
|
if (preferredHost) {
|
|
2266
|
-
const preferred = hosts.find(
|
|
2269
|
+
const preferred = hosts.find(
|
|
2270
|
+
(h) => h.id === preferredHost || h.name === preferredHost
|
|
2271
|
+
);
|
|
2267
2272
|
if (preferred) {
|
|
2268
|
-
hosts = [preferred, ...hosts.filter((h) => h.id !==
|
|
2273
|
+
hosts = [preferred, ...hosts.filter((h) => h.id !== preferred.id)];
|
|
2269
2274
|
return hosts;
|
|
2270
2275
|
}
|
|
2271
2276
|
}
|