@yzj01/llm-router 1.0.2 → 1.0.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/dist/cli.d.ts +1 -1
- package/dist/cli.js +12 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/{proxy-CpR5cxND.d.ts → proxy-B7j2DcEK.d.ts} +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1792,7 +1792,7 @@ function hashHex(value, length) {
|
|
|
1792
1792
|
}
|
|
1793
1793
|
|
|
1794
1794
|
// src/proxy.ts
|
|
1795
|
-
var VERSION = "1.0.
|
|
1795
|
+
var VERSION = "1.0.3";
|
|
1796
1796
|
var HOP_BY_HOP = /* @__PURE__ */ new Set([
|
|
1797
1797
|
"connection",
|
|
1798
1798
|
"keep-alive",
|
|
@@ -1896,7 +1896,9 @@ function extractPrompt(messages) {
|
|
|
1896
1896
|
const parts = [];
|
|
1897
1897
|
let system;
|
|
1898
1898
|
let openingText = "";
|
|
1899
|
-
let
|
|
1899
|
+
let routeUserText = "";
|
|
1900
|
+
let previousRole;
|
|
1901
|
+
let previousUserText = "";
|
|
1900
1902
|
for (const msg of messages) {
|
|
1901
1903
|
if (!msg || typeof msg !== "object") continue;
|
|
1902
1904
|
const role = msg.role;
|
|
@@ -1915,15 +1917,21 @@ ${text2}` : text2;
|
|
|
1915
1917
|
} else {
|
|
1916
1918
|
parts.push(text2);
|
|
1917
1919
|
if (role === "user" && text2.trim()) {
|
|
1918
|
-
|
|
1920
|
+
if (previousRole === "user" && previousUserText.trim()) {
|
|
1921
|
+
routeUserText = previousUserText;
|
|
1922
|
+
} else {
|
|
1923
|
+
routeUserText = extractRouteTextFromUserMessage(text2);
|
|
1924
|
+
}
|
|
1919
1925
|
}
|
|
1920
1926
|
if (!openingText && text2.trim()) {
|
|
1921
1927
|
openingText = text2;
|
|
1922
1928
|
}
|
|
1923
1929
|
}
|
|
1930
|
+
previousRole = role;
|
|
1931
|
+
previousUserText = role === "user" ? extractRouteTextFromUserMessage(text2) : "";
|
|
1924
1932
|
}
|
|
1925
1933
|
const text = parts.join(" ");
|
|
1926
|
-
return { text, routeText:
|
|
1934
|
+
return { text, routeText: routeUserText || text, system, openingText };
|
|
1927
1935
|
}
|
|
1928
1936
|
function buildUpstreamHeaders(req, cfg) {
|
|
1929
1937
|
const headers = {};
|