@thanh01.pmt/curriculum-kit 1.4.27 → 1.4.28
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/ai/index.cjs +35 -1
- package/dist/ai/index.cjs.map +1 -1
- package/dist/ai/index.mjs +35 -1
- package/dist/ai/index.mjs.map +1 -1
- package/dist/index.cjs +35 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +35 -1
- package/dist/index.mjs.map +1 -1
- package/dist/media/index.cjs +35 -1
- package/dist/media/index.cjs.map +1 -1
- package/dist/media/index.mjs +35 -1
- package/dist/media/index.mjs.map +1 -1
- package/dist/pipeline/index.cjs.map +1 -1
- package/dist/pipeline/index.mjs.map +1 -1
- package/dist/workflow/index.cjs +35 -1
- package/dist/workflow/index.cjs.map +1 -1
- package/dist/workflow/index.mjs +35 -1
- package/dist/workflow/index.mjs.map +1 -1
- package/package.json +23 -22
- package/LICENSE +0 -21
package/dist/media/index.cjs
CHANGED
|
@@ -970,7 +970,41 @@ Guidelines:
|
|
|
970
970
|
);
|
|
971
971
|
for (const target of fallbackChain) {
|
|
972
972
|
const { provider, model } = target;
|
|
973
|
-
if (provider === "
|
|
973
|
+
if ((provider === "9router" || provider === "ninerouter") && ninerouterKey && isProviderEnabled("9router")) {
|
|
974
|
+
try {
|
|
975
|
+
const rawUrl = resolveApiKey2("NINEROUTER_BASE_URL") || resolveApiKey2("NINE_ROUTER_BASE_URL") || "https://ai-router.orchable.app/v1";
|
|
976
|
+
const fbBaseUrl = rawUrl.replace(/["']/g, "").replace(/\/$/, "");
|
|
977
|
+
const idle = createStreamAbortController({ idleMs: 45e3, totalMs: 3e5 });
|
|
978
|
+
const res = await fetch(`${fbBaseUrl}/chat/completions`, {
|
|
979
|
+
method: "POST",
|
|
980
|
+
headers: {
|
|
981
|
+
"Authorization": `Bearer ${ninerouterKey}`,
|
|
982
|
+
"Content-Type": "application/json"
|
|
983
|
+
},
|
|
984
|
+
body: JSON.stringify({
|
|
985
|
+
model,
|
|
986
|
+
messages: formattedMessages,
|
|
987
|
+
max_tokens: maxTokens,
|
|
988
|
+
temperature,
|
|
989
|
+
stream: true,
|
|
990
|
+
stream_options: { include_usage: true }
|
|
991
|
+
}),
|
|
992
|
+
signal: idle.signal
|
|
993
|
+
});
|
|
994
|
+
if (res.ok) {
|
|
995
|
+
const text = await processOpenAISSEStream(res, onChunk, idle);
|
|
996
|
+
if (text && text.trim()) {
|
|
997
|
+
console.log(`[streamRunner] \u2705 Designated fallback 9Router (${model}) succeeded!`);
|
|
998
|
+
return text;
|
|
999
|
+
}
|
|
1000
|
+
} else {
|
|
1001
|
+
const errText = await res.text().catch(() => "");
|
|
1002
|
+
providerErrors[`designated_fallback_9router_${model}`] = `HTTP ${res.status}: ${errText.slice(0, 120)}`;
|
|
1003
|
+
}
|
|
1004
|
+
} catch (e) {
|
|
1005
|
+
providerErrors[`designated_fallback_9router_${model}`] = e?.message || "Network error";
|
|
1006
|
+
}
|
|
1007
|
+
} else if (provider === "nvidia" && nvidiaKey && isProviderEnabled("nvidia")) {
|
|
974
1008
|
try {
|
|
975
1009
|
const nvdIdle = options.idleTimeoutMs ?? 18e4;
|
|
976
1010
|
const nvdTotal = options.timeoutMs ?? 6e5;
|