@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.
- package/dist/ai/index.cjs +46 -2
- package/dist/ai/index.cjs.map +1 -1
- package/dist/ai/index.d.cts +2 -2
- package/dist/ai/index.d.ts +2 -2
- package/dist/ai/index.mjs +46 -2
- package/dist/ai/index.mjs.map +1 -1
- package/dist/index.cjs +76 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +76 -3
- package/dist/index.mjs.map +1 -1
- package/dist/media/index.cjs +46 -2
- package/dist/media/index.cjs.map +1 -1
- package/dist/media/index.d.cts +1 -1
- package/dist/media/index.d.ts +1 -1
- package/dist/media/index.mjs +46 -2
- package/dist/media/index.mjs.map +1 -1
- package/dist/pipeline/index.cjs.map +1 -1
- package/dist/pipeline/index.d.cts +1 -1
- package/dist/pipeline/index.d.ts +1 -1
- package/dist/pipeline/index.mjs.map +1 -1
- package/dist/publishers/index.d.cts +1 -1
- package/dist/publishers/index.d.ts +1 -1
- package/dist/storage/index.cjs +27 -0
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.cts +11 -2
- package/dist/storage/index.d.ts +11 -2
- package/dist/storage/index.mjs +27 -0
- package/dist/storage/index.mjs.map +1 -1
- package/dist/{streamRunner-kpS4MZP1.d.cts → streamRunner-DYHFhNUr.d.cts} +1 -1
- package/dist/{streamRunner-kpS4MZP1.d.ts → streamRunner-DYHFhNUr.d.ts} +1 -1
- package/dist/{types-BUJGYiep.d.ts → types-Bgk-C4K2.d.cts} +11 -0
- package/dist/{types-BUJGYiep.d.cts → types-Bgk-C4K2.d.ts} +11 -0
- package/dist/workflow/index.cjs +48 -3
- package/dist/workflow/index.cjs.map +1 -1
- package/dist/workflow/index.mjs +48 -3
- package/dist/workflow/index.mjs.map +1 -1
- package/package.json +23 -22
- package/LICENSE +0 -21
package/dist/workflow/index.mjs
CHANGED
|
@@ -500,7 +500,12 @@ Guidelines:
|
|
|
500
500
|
const unique9RouterModels = Array.from(new Set(candidateModels));
|
|
501
501
|
for (const model of unique9RouterModels) {
|
|
502
502
|
try {
|
|
503
|
-
const
|
|
503
|
+
const r9Idle = options.idleTimeoutMs ?? (Number(process.env.ARTIFACT_STREAM_IDLE_TIMEOUT_MS || process.env.STREAM_IDLE_TIMEOUT_MS) || 0) ?? 0;
|
|
504
|
+
const r9Total = options.timeoutMs ?? (Number(process.env.ARTIFACT_STREAM_TOTAL_TIMEOUT_MS || process.env.STREAM_TOTAL_TIMEOUT_MS) || 0) ?? 0;
|
|
505
|
+
const idle = createStreamAbortController({
|
|
506
|
+
idleMs: r9Idle > 0 ? r9Idle : 9e4,
|
|
507
|
+
totalMs: r9Total > 0 ? r9Total : 3e5
|
|
508
|
+
});
|
|
504
509
|
const res = await fetch(`${ninerouterBaseUrl}/chat/completions`, {
|
|
505
510
|
method: "POST",
|
|
506
511
|
headers: {
|
|
@@ -739,7 +744,46 @@ Guidelines:
|
|
|
739
744
|
);
|
|
740
745
|
for (const target of fallbackChain) {
|
|
741
746
|
const { provider, model } = target;
|
|
742
|
-
if (provider === "
|
|
747
|
+
if ((provider === "9router" || provider === "ninerouter") && ninerouterKey && isProviderEnabled("9router")) {
|
|
748
|
+
try {
|
|
749
|
+
const rawUrl = resolveApiKey("NINEROUTER_BASE_URL") || resolveApiKey("NINE_ROUTER_BASE_URL") || "https://ai-router.orchable.app/v1";
|
|
750
|
+
const fbBaseUrl = rawUrl.replace(/["']/g, "").replace(/\/$/, "");
|
|
751
|
+
const fbIdle = options.idleTimeoutMs ?? (Number(process.env.ARTIFACT_STREAM_IDLE_TIMEOUT_MS || process.env.STREAM_IDLE_TIMEOUT_MS) || 0) ?? 0;
|
|
752
|
+
const fbTotal = options.timeoutMs ?? (Number(process.env.ARTIFACT_STREAM_TOTAL_TIMEOUT_MS || process.env.STREAM_TOTAL_TIMEOUT_MS) || 0) ?? 0;
|
|
753
|
+
const idle = createStreamAbortController({
|
|
754
|
+
idleMs: fbIdle > 0 ? fbIdle : 9e4,
|
|
755
|
+
totalMs: fbTotal > 0 ? fbTotal : 3e5
|
|
756
|
+
});
|
|
757
|
+
const res = await fetch(`${fbBaseUrl}/chat/completions`, {
|
|
758
|
+
method: "POST",
|
|
759
|
+
headers: {
|
|
760
|
+
"Authorization": `Bearer ${ninerouterKey}`,
|
|
761
|
+
"Content-Type": "application/json"
|
|
762
|
+
},
|
|
763
|
+
body: JSON.stringify({
|
|
764
|
+
model,
|
|
765
|
+
messages: formattedMessages,
|
|
766
|
+
max_tokens: maxTokens,
|
|
767
|
+
temperature,
|
|
768
|
+
stream: true,
|
|
769
|
+
stream_options: { include_usage: true }
|
|
770
|
+
}),
|
|
771
|
+
signal: idle.signal
|
|
772
|
+
});
|
|
773
|
+
if (res.ok) {
|
|
774
|
+
const text = await processOpenAISSEStream(res, onChunk, idle);
|
|
775
|
+
if (text && text.trim()) {
|
|
776
|
+
console.log(`[streamRunner] \u2705 Designated fallback 9Router (${model}) succeeded!`);
|
|
777
|
+
return text;
|
|
778
|
+
}
|
|
779
|
+
} else {
|
|
780
|
+
const errText = await res.text().catch(() => "");
|
|
781
|
+
providerErrors[`designated_fallback_9router_${model}`] = `HTTP ${res.status}: ${errText.slice(0, 120)}`;
|
|
782
|
+
}
|
|
783
|
+
} catch (e) {
|
|
784
|
+
providerErrors[`designated_fallback_9router_${model}`] = e?.message || "Network error";
|
|
785
|
+
}
|
|
786
|
+
} else if (provider === "nvidia" && nvidiaKey && isProviderEnabled("nvidia")) {
|
|
743
787
|
try {
|
|
744
788
|
const nvdIdle = options.idleTimeoutMs ?? 18e4;
|
|
745
789
|
const nvdTotal = options.timeoutMs ?? 6e5;
|
|
@@ -18740,7 +18784,8 @@ function buildLanguageDirective(targetLanguage) {
|
|
|
18740
18784
|
- All section titles, table headers, table cells, lesson names, learning objectives, pedagogical narratives, and cognitive analyses MUST be written in natural, fluent, academic ${name}.
|
|
18741
18785
|
- Technical identifiers, code keywords (e.g. setup(), loop(), pinMode()), standard protocols (I2C, SPI, UART, GPIO), and component model numbers (ESP32, Arduino Uno) remain in standard technical notation, but all surrounding explanations MUST be in ${name}.
|
|
18742
18786
|
- DO NOT mix in paragraphs, tables, or titles written in any other language. Strict adherence is required.${exampleLine ? `
|
|
18743
|
-
${exampleLine}` : ""}
|
|
18787
|
+
${exampleLine}` : ""}
|
|
18788
|
+
- CJK / NON-LATIN SCRIPT BAN (ABSOLUTE): NEVER output characters from Chinese (\u6C49\u5B57), Japanese (\u304B\u306A/\u6F22\u5B57), or Korean (\uD55C\uAE00) scripts ANYWHERE in the document \u2014 not even a single glyph spliced inside a ${name} sentence. Observed past violations that are STRICTLY forbidden: \u6392\u67E5, \u5305\u542B, \u5BFC\u81F4, \u662F\u591A\u5C11, \u6280\u672F, \u771F\u673A, \u4F11\u606F, \u7EB8\u8D28. To express such meaning write it fully in ${name} or keep the ENGLISH technical term (e.g. write "t\u1EF1 ki\u1EC3m tra l\u1ED7i" / "self-debugging", "bao g\u1ED3m" / "includes"). A mechanical scanner rejects any document containing even one CJK character.`;
|
|
18744
18789
|
}
|
|
18745
18790
|
function matchesArtifactType(candidate, target) {
|
|
18746
18791
|
const c = candidate.trim().toUpperCase();
|