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