@openclawcity/become 1.0.19 → 1.0.23
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/README.md +12 -8
- package/dist/cli.cjs +28 -7
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +28 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3366,11 +3366,17 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
|
|
|
3366
3366
|
const upstreamHeaders = buildUpstreamHeaders(config, req.headers);
|
|
3367
3367
|
const isStreaming = body.stream === true;
|
|
3368
3368
|
const modifiedBody = JSON.stringify(body);
|
|
3369
|
+
console.log(`[become] -> ${upstreamUrl} (${isStreaming ? "streaming" : "non-streaming"})`);
|
|
3369
3370
|
const upstreamRes = await fetch(upstreamUrl, {
|
|
3370
3371
|
method: "POST",
|
|
3371
3372
|
headers: upstreamHeaders,
|
|
3372
3373
|
body: modifiedBody
|
|
3373
3374
|
});
|
|
3375
|
+
console.log(`[become] <- ${upstreamRes.status} ${upstreamRes.statusText}`);
|
|
3376
|
+
if (!upstreamRes.ok) {
|
|
3377
|
+
const errBody = await upstreamRes.text().catch(() => "");
|
|
3378
|
+
console.log(`[become] ERROR: ${errBody.slice(0, 500)}`);
|
|
3379
|
+
}
|
|
3374
3380
|
stats.requests_forwarded++;
|
|
3375
3381
|
const responseHeaders = {};
|
|
3376
3382
|
upstreamRes.headers.forEach((value, key) => {
|
|
@@ -3407,6 +3413,7 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
|
|
|
3407
3413
|
}
|
|
3408
3414
|
}
|
|
3409
3415
|
} catch (err) {
|
|
3416
|
+
console.log(`[become] EXCEPTION: ${err instanceof Error ? err.message : String(err)}`);
|
|
3410
3417
|
const safeMessage = err instanceof Error && err.message === "Request body too large" ? "Request body too large" : "Failed to forward request to LLM";
|
|
3411
3418
|
if (!res.headersSent) {
|
|
3412
3419
|
res.writeHead(502, { "Content-Type": "application/json" });
|