@elvatis_com/openclaw-cli-bridge-elvatis 1.8.2 → 1.8.3
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/package.json +2 -2
- package/src/proxy-server.ts +18 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elvatis_com/openclaw-cli-bridge-elvatis",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "Bridges gemini, claude, and codex CLI tools as OpenClaw model providers. Reads existing CLI auth without re-login.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"openclaw": {
|
|
@@ -22,4 +22,4 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"playwright": "^1.58.2"
|
|
24
24
|
}
|
|
25
|
-
}
|
|
25
|
+
}
|
package/src/proxy-server.ts
CHANGED
|
@@ -562,7 +562,24 @@ async function handleRequest(
|
|
|
562
562
|
if (model.startsWith("local-bitnet/")) {
|
|
563
563
|
const bitnetUrl = opts.getBitNetServerUrl?.() ?? "http://127.0.0.1:8082";
|
|
564
564
|
const timeoutMs = opts.timeoutMs ?? 120_000;
|
|
565
|
-
|
|
565
|
+
// llama-server (BitNet build) crashes with std::runtime_error on multi-part
|
|
566
|
+
// content arrays (ref: https://github.com/ggerganov/llama.cpp/issues/8367).
|
|
567
|
+
// Flatten all message content to plain strings before forwarding.
|
|
568
|
+
const flattenContent = (content: unknown): string => {
|
|
569
|
+
if (typeof content === "string") return content;
|
|
570
|
+
if (Array.isArray(content)) {
|
|
571
|
+
return content
|
|
572
|
+
.filter((c): c is { type: string; text?: string } => typeof c === "object" && c !== null)
|
|
573
|
+
.map((c) => (c.type === "text" && typeof c.text === "string" ? c.text : ""))
|
|
574
|
+
.join("");
|
|
575
|
+
}
|
|
576
|
+
return String(content ?? "");
|
|
577
|
+
};
|
|
578
|
+
const bitnetMessages = parsed.messages.map((m) => ({
|
|
579
|
+
role: m.role,
|
|
580
|
+
content: flattenContent(m.content),
|
|
581
|
+
}));
|
|
582
|
+
const requestBody = JSON.stringify({ ...parsed, messages: bitnetMessages, tools: undefined });
|
|
566
583
|
|
|
567
584
|
try {
|
|
568
585
|
const targetUrl = new URL("/v1/chat/completions", bitnetUrl);
|