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