@yzj01/llm-router 1.0.1 → 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 +14 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/{proxy-Co87mKak.d.ts → proxy-B7j2DcEK.d.ts} +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Tier, R as RawConfig, b as PhysicalModel, P as ProxyOptions, a as ProxyHandle, c as TraceMode, d as TraceLogger, C as ConfigSource, e as PublicModelConfig } from './proxy-
|
|
2
|
-
export { D as DEFAULT_SESSION_CONFIG, f as PublicModelMetadata, g as RouteTraceLog, S as SessionConfig, h as SessionEntry, i as SessionStats, j as SessionStore, k as TierEntry, l as TraceAttempt, m as TraceReason, n as TraceSessionAction, o as TraceSummaryInput, p as TraceWriter, V as VERSION, q as buildTraceSummary, r as deriveSessionId, s as emitRouteTrace, t as getPromptPreview, u as hashRequestContent, v as normalizeTraceMode, w as resolveTraceWriter, x as startProxy } from './proxy-
|
|
1
|
+
import { T as Tier, R as RawConfig, b as PhysicalModel, P as ProxyOptions, a as ProxyHandle, c as TraceMode, d as TraceLogger, C as ConfigSource, e as PublicModelConfig } from './proxy-B7j2DcEK.js';
|
|
2
|
+
export { D as DEFAULT_SESSION_CONFIG, f as PublicModelMetadata, g as RouteTraceLog, S as SessionConfig, h as SessionEntry, i as SessionStats, j as SessionStore, k as TierEntry, l as TraceAttempt, m as TraceReason, n as TraceSessionAction, o as TraceSummaryInput, p as TraceWriter, V as VERSION, q as buildTraceSummary, r as deriveSessionId, s as emitRouteTrace, t as getPromptPreview, u as hashRequestContent, v as normalizeTraceMode, w as resolveTraceWriter, x as startProxy } from './proxy-B7j2DcEK.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 路由层只关心 alias 的成本画像,因此这里的 key 是 public alias,而不是
|
package/dist/index.js
CHANGED
|
@@ -1643,7 +1643,7 @@ function hashHex(value, length) {
|
|
|
1643
1643
|
}
|
|
1644
1644
|
|
|
1645
1645
|
// src/proxy.ts
|
|
1646
|
-
var VERSION = "1.0.
|
|
1646
|
+
var VERSION = "1.0.3";
|
|
1647
1647
|
var HOP_BY_HOP = /* @__PURE__ */ new Set([
|
|
1648
1648
|
"connection",
|
|
1649
1649
|
"keep-alive",
|
|
@@ -1740,15 +1740,16 @@ function readBody(req, limits) {
|
|
|
1740
1740
|
}
|
|
1741
1741
|
var OPENCLAW_CLI_TURN_PATTERN = /(?:^|\n)\[[^\]\n]+?\]\s+([\s\S]*?)(?=(?:\n\[[^\]\n]+?\]\s+)|$)/g;
|
|
1742
1742
|
function extractRouteTextFromUserMessage(text) {
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
return last || text;
|
|
1743
|
+
void OPENCLAW_CLI_TURN_PATTERN;
|
|
1744
|
+
return text;
|
|
1746
1745
|
}
|
|
1747
1746
|
function extractPrompt(messages) {
|
|
1748
1747
|
const parts = [];
|
|
1749
1748
|
let system;
|
|
1750
1749
|
let openingText = "";
|
|
1751
|
-
let
|
|
1750
|
+
let routeUserText = "";
|
|
1751
|
+
let previousRole;
|
|
1752
|
+
let previousUserText = "";
|
|
1752
1753
|
for (const msg of messages) {
|
|
1753
1754
|
if (!msg || typeof msg !== "object") continue;
|
|
1754
1755
|
const role = msg.role;
|
|
@@ -1767,15 +1768,21 @@ ${text2}` : text2;
|
|
|
1767
1768
|
} else {
|
|
1768
1769
|
parts.push(text2);
|
|
1769
1770
|
if (role === "user" && text2.trim()) {
|
|
1770
|
-
|
|
1771
|
+
if (previousRole === "user" && previousUserText.trim()) {
|
|
1772
|
+
routeUserText = previousUserText;
|
|
1773
|
+
} else {
|
|
1774
|
+
routeUserText = extractRouteTextFromUserMessage(text2);
|
|
1775
|
+
}
|
|
1771
1776
|
}
|
|
1772
1777
|
if (!openingText && text2.trim()) {
|
|
1773
1778
|
openingText = text2;
|
|
1774
1779
|
}
|
|
1775
1780
|
}
|
|
1781
|
+
previousRole = role;
|
|
1782
|
+
previousUserText = role === "user" ? extractRouteTextFromUserMessage(text2) : "";
|
|
1776
1783
|
}
|
|
1777
1784
|
const text = parts.join(" ");
|
|
1778
|
-
return { text, routeText:
|
|
1785
|
+
return { text, routeText: routeUserText || text, system, openingText };
|
|
1779
1786
|
}
|
|
1780
1787
|
function buildUpstreamHeaders(req, cfg) {
|
|
1781
1788
|
const headers = {};
|