@openclawcity/become 1.0.19 → 1.0.20
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/cli.cjs +7 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +7 -0
- 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/cli.js
CHANGED
|
@@ -807,11 +807,17 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
|
|
|
807
807
|
const upstreamHeaders = buildUpstreamHeaders(config, req.headers);
|
|
808
808
|
const isStreaming = body.stream === true;
|
|
809
809
|
const modifiedBody = JSON.stringify(body);
|
|
810
|
+
console.log(`[become] -> ${upstreamUrl} (${isStreaming ? "streaming" : "non-streaming"})`);
|
|
810
811
|
const upstreamRes = await fetch(upstreamUrl, {
|
|
811
812
|
method: "POST",
|
|
812
813
|
headers: upstreamHeaders,
|
|
813
814
|
body: modifiedBody
|
|
814
815
|
});
|
|
816
|
+
console.log(`[become] <- ${upstreamRes.status} ${upstreamRes.statusText}`);
|
|
817
|
+
if (!upstreamRes.ok) {
|
|
818
|
+
const errBody = await upstreamRes.text().catch(() => "");
|
|
819
|
+
console.log(`[become] ERROR: ${errBody.slice(0, 500)}`);
|
|
820
|
+
}
|
|
815
821
|
stats.requests_forwarded++;
|
|
816
822
|
const responseHeaders = {};
|
|
817
823
|
upstreamRes.headers.forEach((value, key) => {
|
|
@@ -848,6 +854,7 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
|
|
|
848
854
|
}
|
|
849
855
|
}
|
|
850
856
|
} catch (err) {
|
|
857
|
+
console.log(`[become] EXCEPTION: ${err instanceof Error ? err.message : String(err)}`);
|
|
851
858
|
const safeMessage = err instanceof Error && err.message === "Request body too large" ? "Request body too large" : "Failed to forward request to LLM";
|
|
852
859
|
if (!res.headersSent) {
|
|
853
860
|
res.writeHead(502, { "Content-Type": "application/json" });
|