@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/index.mjs
CHANGED
|
@@ -766,7 +766,41 @@ Guidelines:
|
|
|
766
766
|
);
|
|
767
767
|
for (const target of fallbackChain) {
|
|
768
768
|
const { provider, model } = target;
|
|
769
|
-
if (provider === "
|
|
769
|
+
if ((provider === "9router" || provider === "ninerouter") && ninerouterKey && isProviderEnabled("9router")) {
|
|
770
|
+
try {
|
|
771
|
+
const rawUrl = resolveApiKey("NINEROUTER_BASE_URL") || resolveApiKey("NINE_ROUTER_BASE_URL") || "https://ai-router.orchable.app/v1";
|
|
772
|
+
const fbBaseUrl = rawUrl.replace(/["']/g, "").replace(/\/$/, "");
|
|
773
|
+
const idle = createStreamAbortController({ idleMs: 45e3, totalMs: 3e5 });
|
|
774
|
+
const res = await fetch(`${fbBaseUrl}/chat/completions`, {
|
|
775
|
+
method: "POST",
|
|
776
|
+
headers: {
|
|
777
|
+
"Authorization": `Bearer ${ninerouterKey}`,
|
|
778
|
+
"Content-Type": "application/json"
|
|
779
|
+
},
|
|
780
|
+
body: JSON.stringify({
|
|
781
|
+
model,
|
|
782
|
+
messages: formattedMessages,
|
|
783
|
+
max_tokens: maxTokens,
|
|
784
|
+
temperature,
|
|
785
|
+
stream: true,
|
|
786
|
+
stream_options: { include_usage: true }
|
|
787
|
+
}),
|
|
788
|
+
signal: idle.signal
|
|
789
|
+
});
|
|
790
|
+
if (res.ok) {
|
|
791
|
+
const text = await processOpenAISSEStream(res, onChunk, idle);
|
|
792
|
+
if (text && text.trim()) {
|
|
793
|
+
console.log(`[streamRunner] \u2705 Designated fallback 9Router (${model}) succeeded!`);
|
|
794
|
+
return text;
|
|
795
|
+
}
|
|
796
|
+
} else {
|
|
797
|
+
const errText = await res.text().catch(() => "");
|
|
798
|
+
providerErrors[`designated_fallback_9router_${model}`] = `HTTP ${res.status}: ${errText.slice(0, 120)}`;
|
|
799
|
+
}
|
|
800
|
+
} catch (e) {
|
|
801
|
+
providerErrors[`designated_fallback_9router_${model}`] = e?.message || "Network error";
|
|
802
|
+
}
|
|
803
|
+
} else if (provider === "nvidia" && nvidiaKey && isProviderEnabled("nvidia")) {
|
|
770
804
|
try {
|
|
771
805
|
const nvdIdle = options.idleTimeoutMs ?? 18e4;
|
|
772
806
|
const nvdTotal = options.timeoutMs ?? 6e5;
|