@thanh01.pmt/curriculum-kit 1.4.27 → 1.4.29

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.
Files changed (40) hide show
  1. package/dist/ai/index.cjs +46 -2
  2. package/dist/ai/index.cjs.map +1 -1
  3. package/dist/ai/index.d.cts +2 -2
  4. package/dist/ai/index.d.ts +2 -2
  5. package/dist/ai/index.mjs +46 -2
  6. package/dist/ai/index.mjs.map +1 -1
  7. package/dist/index.cjs +76 -3
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +4 -4
  10. package/dist/index.d.ts +4 -4
  11. package/dist/index.mjs +76 -3
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/media/index.cjs +46 -2
  14. package/dist/media/index.cjs.map +1 -1
  15. package/dist/media/index.d.cts +1 -1
  16. package/dist/media/index.d.ts +1 -1
  17. package/dist/media/index.mjs +46 -2
  18. package/dist/media/index.mjs.map +1 -1
  19. package/dist/pipeline/index.cjs.map +1 -1
  20. package/dist/pipeline/index.d.cts +1 -1
  21. package/dist/pipeline/index.d.ts +1 -1
  22. package/dist/pipeline/index.mjs.map +1 -1
  23. package/dist/publishers/index.d.cts +1 -1
  24. package/dist/publishers/index.d.ts +1 -1
  25. package/dist/storage/index.cjs +27 -0
  26. package/dist/storage/index.cjs.map +1 -1
  27. package/dist/storage/index.d.cts +11 -2
  28. package/dist/storage/index.d.ts +11 -2
  29. package/dist/storage/index.mjs +27 -0
  30. package/dist/storage/index.mjs.map +1 -1
  31. package/dist/{streamRunner-kpS4MZP1.d.cts → streamRunner-DYHFhNUr.d.cts} +1 -1
  32. package/dist/{streamRunner-kpS4MZP1.d.ts → streamRunner-DYHFhNUr.d.ts} +1 -1
  33. package/dist/{types-BUJGYiep.d.ts → types-Bgk-C4K2.d.cts} +11 -0
  34. package/dist/{types-BUJGYiep.d.cts → types-Bgk-C4K2.d.ts} +11 -0
  35. package/dist/workflow/index.cjs +48 -3
  36. package/dist/workflow/index.cjs.map +1 -1
  37. package/dist/workflow/index.mjs +48 -3
  38. package/dist/workflow/index.mjs.map +1 -1
  39. package/package.json +23 -22
  40. package/LICENSE +0 -21
@@ -1,4 +1,4 @@
1
- import { S as StreamRunnerOptions } from '../streamRunner-kpS4MZP1.cjs';
1
+ import { S as StreamRunnerOptions } from '../streamRunner-DYHFhNUr.cjs';
2
2
 
3
3
  /**
4
4
  * Media Types — image generation, image search, video search cho học liệu.
@@ -1,4 +1,4 @@
1
- import { S as StreamRunnerOptions } from '../streamRunner-kpS4MZP1.js';
1
+ import { S as StreamRunnerOptions } from '../streamRunner-DYHFhNUr.js';
2
2
 
3
3
  /**
4
4
  * Media Types — image generation, image search, video search cho học liệu.
@@ -724,7 +724,12 @@ Guidelines:
724
724
  const unique9RouterModels = Array.from(new Set(candidateModels));
725
725
  for (const model of unique9RouterModels) {
726
726
  try {
727
- const idle = createStreamAbortController({ idleMs: 45e3, totalMs: 3e5 });
727
+ const r9Idle = options.idleTimeoutMs ?? (Number(process.env.ARTIFACT_STREAM_IDLE_TIMEOUT_MS || process.env.STREAM_IDLE_TIMEOUT_MS) || 0) ?? 0;
728
+ const r9Total = options.timeoutMs ?? (Number(process.env.ARTIFACT_STREAM_TOTAL_TIMEOUT_MS || process.env.STREAM_TOTAL_TIMEOUT_MS) || 0) ?? 0;
729
+ const idle = createStreamAbortController({
730
+ idleMs: r9Idle > 0 ? r9Idle : 9e4,
731
+ totalMs: r9Total > 0 ? r9Total : 3e5
732
+ });
728
733
  const res = await fetch(`${ninerouterBaseUrl}/chat/completions`, {
729
734
  method: "POST",
730
735
  headers: {
@@ -963,7 +968,46 @@ Guidelines:
963
968
  );
964
969
  for (const target of fallbackChain) {
965
970
  const { provider, model } = target;
966
- if (provider === "nvidia" && nvidiaKey && isProviderEnabled("nvidia")) {
971
+ if ((provider === "9router" || provider === "ninerouter") && ninerouterKey && isProviderEnabled("9router")) {
972
+ try {
973
+ const rawUrl = resolveApiKey2("NINEROUTER_BASE_URL") || resolveApiKey2("NINE_ROUTER_BASE_URL") || "https://ai-router.orchable.app/v1";
974
+ const fbBaseUrl = rawUrl.replace(/["']/g, "").replace(/\/$/, "");
975
+ const fbIdle = options.idleTimeoutMs ?? (Number(process.env.ARTIFACT_STREAM_IDLE_TIMEOUT_MS || process.env.STREAM_IDLE_TIMEOUT_MS) || 0) ?? 0;
976
+ const fbTotal = options.timeoutMs ?? (Number(process.env.ARTIFACT_STREAM_TOTAL_TIMEOUT_MS || process.env.STREAM_TOTAL_TIMEOUT_MS) || 0) ?? 0;
977
+ const idle = createStreamAbortController({
978
+ idleMs: fbIdle > 0 ? fbIdle : 9e4,
979
+ totalMs: fbTotal > 0 ? fbTotal : 3e5
980
+ });
981
+ const res = await fetch(`${fbBaseUrl}/chat/completions`, {
982
+ method: "POST",
983
+ headers: {
984
+ "Authorization": `Bearer ${ninerouterKey}`,
985
+ "Content-Type": "application/json"
986
+ },
987
+ body: JSON.stringify({
988
+ model,
989
+ messages: formattedMessages,
990
+ max_tokens: maxTokens,
991
+ temperature,
992
+ stream: true,
993
+ stream_options: { include_usage: true }
994
+ }),
995
+ signal: idle.signal
996
+ });
997
+ if (res.ok) {
998
+ const text = await processOpenAISSEStream(res, onChunk, idle);
999
+ if (text && text.trim()) {
1000
+ console.log(`[streamRunner] \u2705 Designated fallback 9Router (${model}) succeeded!`);
1001
+ return text;
1002
+ }
1003
+ } else {
1004
+ const errText = await res.text().catch(() => "");
1005
+ providerErrors[`designated_fallback_9router_${model}`] = `HTTP ${res.status}: ${errText.slice(0, 120)}`;
1006
+ }
1007
+ } catch (e) {
1008
+ providerErrors[`designated_fallback_9router_${model}`] = e?.message || "Network error";
1009
+ }
1010
+ } else if (provider === "nvidia" && nvidiaKey && isProviderEnabled("nvidia")) {
967
1011
  try {
968
1012
  const nvdIdle = options.idleTimeoutMs ?? 18e4;
969
1013
  const nvdTotal = options.timeoutMs ?? 6e5;