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