billion-context 0.1.75-pr.485.304 → 0.1.75-pr.486.305
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/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57890,14 +57890,28 @@ ${hdrText}
|
|
|
57890
57890
|
}
|
|
57891
57891
|
if (prepared?.pluginMode) {
|
|
57892
57892
|
try {
|
|
57893
|
+
let pluginBody = upstream.body;
|
|
57894
|
+
if (prepared.stream && maxFakeCompletionRetries() > 0) {
|
|
57895
|
+
const resolvedBuf = await resolveFakeCompletion(pluginBody, {
|
|
57896
|
+
protocol: prepared.protocol,
|
|
57897
|
+
body,
|
|
57898
|
+
upstreamUrl,
|
|
57899
|
+
reqHeaders: buildForwardHeaders(headers),
|
|
57900
|
+
proxyUrl,
|
|
57901
|
+
signal: clientAbort.signal,
|
|
57902
|
+
session: prepared.session,
|
|
57903
|
+
log: log2
|
|
57904
|
+
});
|
|
57905
|
+
pluginBody = bufferToStream(resolvedBuf);
|
|
57906
|
+
}
|
|
57893
57907
|
if (prepared.stream) {
|
|
57894
57908
|
if (prepared.protocol === "responses") {
|
|
57895
|
-
await pipePluginResponsesWithStrip(
|
|
57909
|
+
await pipePluginResponsesWithStrip(pluginBody, res, prepared.session, (msg) => log2("info", `[${prepared.session.id}] ${msg}`));
|
|
57896
57910
|
} else {
|
|
57897
|
-
await pipePluginChatWithStrip(
|
|
57911
|
+
await pipePluginChatWithStrip(pluginBody, res, prepared.protocol, prepared.session, (msg) => log2("info", `[${prepared.session.id}] ${msg}`));
|
|
57898
57912
|
}
|
|
57899
57913
|
} else {
|
|
57900
|
-
await pipePluginJson(
|
|
57914
|
+
await pipePluginJson(pluginBody, res, prepared.session, prepared.protocol);
|
|
57901
57915
|
}
|
|
57902
57916
|
} finally {
|
|
57903
57917
|
clearUpstreamTimer();
|