@intellectif/lk-core 1.6.0 → 1.8.0
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/CHANGELOG.md +36 -0
- package/dist/{ai-i3jwXnpX.d.ts → ai-Cnm0qE8v.d.cts} +334 -16
- package/dist/ai-Cnm0qE8v.d.cts.map +1 -0
- package/dist/{ai-i3jwXnpX.d.cts → ai-Cnm0qE8v.d.ts} +334 -16
- package/dist/ai-Cnm0qE8v.d.ts.map +1 -0
- package/dist/ai-check.cjs +88 -7
- package/dist/ai-check.cjs.map +1 -1
- package/dist/ai-check.d.cts +11 -7
- package/dist/ai-check.d.cts.map +1 -1
- package/dist/ai-check.d.ts +11 -7
- package/dist/ai-check.d.ts.map +1 -1
- package/dist/ai-check.js +88 -7
- package/dist/ai-check.js.map +1 -1
- package/dist/{ai-writing-C4YRVrFi.cjs → ai-writing-Bh2Y53cY.cjs} +2567 -203
- package/dist/ai-writing-Bh2Y53cY.cjs.map +1 -0
- package/dist/{ai-writing-OJ5m_1EB.js → ai-writing-DeIV-GfN.js} +2428 -172
- package/dist/ai-writing-DeIV-GfN.js.map +1 -0
- package/dist/{index-Dj92T76o.d.ts → index-CtoPhJAH.d.ts} +2 -8
- package/dist/index-CtoPhJAH.d.ts.map +1 -0
- package/dist/{index--U7hHV0s.d.cts → index-DMh3OYSb.d.cts} +2 -8
- package/dist/index-DMh3OYSb.d.cts.map +1 -0
- package/dist/{index-WBHSrIUU.d.ts → index-HXvg0YRQ.d.ts} +5 -12
- package/dist/index-HXvg0YRQ.d.ts.map +1 -0
- package/dist/{index-CFRgZLhH.d.cts → index-fZ67k-WR.d.cts} +5 -12
- package/dist/index-fZ67k-WR.d.cts.map +1 -0
- package/dist/{index-DeD8EI1D.d.ts → index-g-EWIugp.d.ts} +2 -42
- package/dist/index-g-EWIugp.d.ts.map +1 -0
- package/dist/{index-Uh1u57yq.d.cts → index-oST8GBFa.d.cts} +2 -42
- package/dist/index-oST8GBFa.d.cts.map +1 -0
- package/dist/index.cjs +287 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +227 -71
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +227 -71
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +276 -21
- package/dist/index.js.map +1 -1
- package/dist/{item-group-BbvvH_Ob.js → item-group-BceUoxoM.js} +4 -6
- package/dist/{item-group-BbvvH_Ob.js.map → item-group-BceUoxoM.js.map} +1 -1
- package/dist/{item-group-CQRbb8Rx.cjs → item-group-KV4hYu3a.cjs} +4 -6
- package/dist/{item-group-CQRbb8Rx.cjs.map → item-group-KV4hYu3a.cjs.map} +1 -1
- package/dist/{registry-Ih5n4PVZ.cjs → registry-Cymq7Ah0.cjs} +97 -92
- package/dist/registry-Cymq7Ah0.cjs.map +1 -0
- package/dist/{registry-B23o9UWh.js → registry-tkacvJUI.js} +79 -91
- package/dist/registry-tkacvJUI.js.map +1 -0
- package/dist/{schemas-yId-bJhD.js → schemas-DM8sN_f0.js} +5 -7
- package/dist/{schemas-yId-bJhD.js.map → schemas-DM8sN_f0.js.map} +1 -1
- package/dist/{schemas-Q2dyOgc2.cjs → schemas-wDzbKdKa.cjs} +5 -7
- package/dist/{schemas-Q2dyOgc2.cjs.map → schemas-wDzbKdKa.cjs.map} +1 -1
- package/dist/schemas.cjs +3 -3
- package/dist/schemas.d.cts +1 -1
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +3 -3
- package/dist/{scoring-CaPS6q8b.cjs → scoring-D9tFvPEG.cjs} +22 -42
- package/dist/{scoring-CaPS6q8b.cjs.map → scoring-D9tFvPEG.cjs.map} +1 -1
- package/dist/{scoring-CLMdk8i9.js → scoring-DIBmo_cy.js} +22 -42
- package/dist/{scoring-CLMdk8i9.js.map → scoring-DIBmo_cy.js.map} +1 -1
- package/dist/scoring.cjs +2 -2
- package/dist/scoring.d.cts +2 -2
- package/dist/scoring.d.ts +2 -2
- package/dist/scoring.js +2 -2
- package/dist/{xapi-BX0hvRRB.cjs → xapi-Dyqcl3JK.cjs} +5 -8
- package/dist/{xapi-BX0hvRRB.cjs.map → xapi-Dyqcl3JK.cjs.map} +1 -1
- package/dist/{xapi-Cdk9fTvV.js → xapi-gCAo549Q.js} +5 -8
- package/dist/{xapi-Cdk9fTvV.js.map → xapi-gCAo549Q.js.map} +1 -1
- package/dist/xapi.cjs +1 -1
- package/dist/xapi.d.cts +1 -1
- package/dist/xapi.d.ts +1 -1
- package/dist/xapi.js +1 -1
- package/package.json +2 -2
- package/vectors/README.md +23 -0
- package/vectors/variants.d.mts +20 -0
- package/vectors/variants.json +5753 -0
- package/vectors/variants.mjs +67 -0
- package/dist/ai-i3jwXnpX.d.cts.map +0 -1
- package/dist/ai-i3jwXnpX.d.ts.map +0 -1
- package/dist/ai-writing-C4YRVrFi.cjs.map +0 -1
- package/dist/ai-writing-OJ5m_1EB.js.map +0 -1
- package/dist/index--U7hHV0s.d.cts.map +0 -1
- package/dist/index-CFRgZLhH.d.cts.map +0 -1
- package/dist/index-DeD8EI1D.d.ts.map +0 -1
- package/dist/index-Dj92T76o.d.ts.map +0 -1
- package/dist/index-Uh1u57yq.d.cts.map +0 -1
- package/dist/index-WBHSrIUU.d.ts.map +0 -1
- package/dist/registry-B23o9UWh.js.map +0 -1
- package/dist/registry-Ih5n4PVZ.cjs.map +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/scoring/text-match.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Configurable free-text answer matching (R3.3).
|
|
4
3
|
*
|
|
@@ -63,8 +62,6 @@ declare function levenshteinDistance(a: string, b: string, max: number): number;
|
|
|
63
62
|
* semantics: `trim` + locale-insensitive `toLowerCase` + strict equality.
|
|
64
63
|
*/
|
|
65
64
|
declare function matchText(input: string, accepted: string | readonly string[], policy?: TextMatchPolicy): TextMatchResult;
|
|
66
|
-
//#endregion
|
|
67
|
-
//#region src/types/grading.d.ts
|
|
68
65
|
/**
|
|
69
66
|
* Lifecycle of a deferred grade. A grade exists only in the `graded` state;
|
|
70
67
|
* every other state means "no grade, and here is why" — which is precisely the
|
|
@@ -243,8 +240,6 @@ interface GradeRecord {
|
|
|
243
240
|
/** Where `routeGrade` sent this grade, and why, when it was routed. */
|
|
244
241
|
routing?: GradeRouting;
|
|
245
242
|
}
|
|
246
|
-
//#endregion
|
|
247
|
-
//#region src/types/xapi.d.ts
|
|
248
243
|
/**
|
|
249
244
|
* An xAPI Activity object — the thing a statement is about.
|
|
250
245
|
* This SDK only builds Activity-type objects (xAPI 1.0.3 §4.1.4.1).
|
|
@@ -402,8 +397,6 @@ interface XAPIError {
|
|
|
402
397
|
/** Human-readable error description. */
|
|
403
398
|
message: string;
|
|
404
399
|
}
|
|
405
|
-
//#endregion
|
|
406
|
-
//#region src/types/activity.d.ts
|
|
407
400
|
/**
|
|
408
401
|
* Maps each ActivityType string to its corresponding data shape.
|
|
409
402
|
*
|
|
@@ -637,6 +630,13 @@ interface MultipleChoiceData {
|
|
|
637
630
|
id: string;
|
|
638
631
|
/** Human-readable title used in xAPI statements and error boundaries. */
|
|
639
632
|
title: string;
|
|
633
|
+
/**
|
|
634
|
+
* Optional instructions shown to the learner, as plain text: the task, read
|
|
635
|
+
* before the question and never part of it ("Choose the correct option to
|
|
636
|
+
* complete the conversation."). Every AI request about the item carries them.
|
|
637
|
+
* Instructions a run of questions shares go in an item group's text stimulus.
|
|
638
|
+
*/
|
|
639
|
+
instructions?: string;
|
|
640
640
|
/** The question stem presented to the learner, as plain text. */
|
|
641
641
|
question: string;
|
|
642
642
|
/**
|
|
@@ -774,6 +774,14 @@ interface GapSelectData {
|
|
|
774
774
|
id: string;
|
|
775
775
|
/** Human-readable title used in xAPI statements and error boundaries. */
|
|
776
776
|
title: string;
|
|
777
|
+
/**
|
|
778
|
+
* Optional instructions shown to the learner, as plain text: the task, read
|
|
779
|
+
* before the passage and never part of it ("Complete the sentence. Use ONE
|
|
780
|
+
* word."). Every AI request about the item carries them. A `{{id}}`
|
|
781
|
+
* placeholder here is refused: gaps live in the passage only. Instructions
|
|
782
|
+
* a run of questions shares go in an item group's text stimulus.
|
|
783
|
+
*/
|
|
784
|
+
instructions?: string;
|
|
777
785
|
/** Passage text containing `{{gap_id}}` placeholders. */
|
|
778
786
|
passage: string;
|
|
779
787
|
/**
|
|
@@ -831,6 +839,14 @@ interface FillInTheBlanksData {
|
|
|
831
839
|
id: string;
|
|
832
840
|
/** Human-readable title used in xAPI statements and error boundaries. */
|
|
833
841
|
title: string;
|
|
842
|
+
/**
|
|
843
|
+
* Optional instructions shown to the learner, as plain text: the task, read
|
|
844
|
+
* before the passage and never part of it ("Complete the sentence. Use ONE
|
|
845
|
+
* word."). Every AI request about the item carries them. A `{{id}}`
|
|
846
|
+
* placeholder here is refused: blanks live in the passage only. Instructions
|
|
847
|
+
* a run of questions shares go in an item group's text stimulus.
|
|
848
|
+
*/
|
|
849
|
+
instructions?: string;
|
|
834
850
|
/** Passage text containing `{{blank_id}}` placeholders. */
|
|
835
851
|
passage: string;
|
|
836
852
|
/**
|
|
@@ -1538,8 +1554,6 @@ interface InteractionEvent {
|
|
|
1538
1554
|
/** Additional event-specific data. */
|
|
1539
1555
|
payload: Record<string, unknown>;
|
|
1540
1556
|
}
|
|
1541
|
-
//#endregion
|
|
1542
|
-
//#region src/types/authoring.d.ts
|
|
1543
1557
|
/**
|
|
1544
1558
|
* Why a draft is not an activity yet.
|
|
1545
1559
|
*
|
|
@@ -1603,6 +1617,60 @@ type ItemFindingSeverity = 'warning' | 'advice';
|
|
|
1603
1617
|
*/
|
|
1604
1618
|
interface ItemFinding extends ValidationError {
|
|
1605
1619
|
severity: ItemFindingSeverity;
|
|
1620
|
+
/**
|
|
1621
|
+
* The other places a finding about several items involves, by path from the
|
|
1622
|
+
* same root as `path`: the item whose passage holds another's answer, the
|
|
1623
|
+
* questions whose keys share a position. Absent when only `path` is involved.
|
|
1624
|
+
*/
|
|
1625
|
+
related?: string[][];
|
|
1626
|
+
}
|
|
1627
|
+
/**
|
|
1628
|
+
* One form of an exam, as `critiqueVersions` reads it: its sections in paper
|
|
1629
|
+
* order, each a list of sequence entries. A host without sections passes one.
|
|
1630
|
+
*/
|
|
1631
|
+
interface VersionPaper {
|
|
1632
|
+
sections: readonly {
|
|
1633
|
+
key?: string;
|
|
1634
|
+
title?: string;
|
|
1635
|
+
entries: readonly unknown[];
|
|
1636
|
+
}[];
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* One thing `critiqueVersions` found between two forms. `a` and `b` are where
|
|
1640
|
+
* it is in each, by path from the paper's root:
|
|
1641
|
+
* `['sections', '0', 'entries', '2', 'items', '1']`.
|
|
1642
|
+
*
|
|
1643
|
+
* - `invalid` — the two are not parallel: a different blueprint, type or
|
|
1644
|
+
* structure, so they do not score alike.
|
|
1645
|
+
* - `warning` — they are parallel, but a re-sitting learner would meet
|
|
1646
|
+
* something again, or one form is longer or tests another objective.
|
|
1647
|
+
* - `advice` — a picture both forms show, which a host may allow.
|
|
1648
|
+
*/
|
|
1649
|
+
interface VersionFinding extends ValidationError {
|
|
1650
|
+
severity: 'invalid' | 'warning' | 'advice';
|
|
1651
|
+
a?: string[];
|
|
1652
|
+
b?: string[];
|
|
1653
|
+
}
|
|
1654
|
+
/** One slot of the first form, with the slot of the second paired with it, and how they were paired. */
|
|
1655
|
+
interface VersionSlot {
|
|
1656
|
+
a: string[] | null;
|
|
1657
|
+
b: string[] | null;
|
|
1658
|
+
by: 'pairs' | 'slotKey' | 'position';
|
|
1659
|
+
}
|
|
1660
|
+
/** What `critiqueVersions` found. */
|
|
1661
|
+
interface VersionComparison {
|
|
1662
|
+
findings: VersionFinding[];
|
|
1663
|
+
/** Every slot of either form — entries, and the items of a group — paired or not. */
|
|
1664
|
+
slots: VersionSlot[];
|
|
1665
|
+
summary: {
|
|
1666
|
+
/** Items in each form: loose activities and the items of groups. */
|
|
1667
|
+
aItems: number;
|
|
1668
|
+
bItems: number;
|
|
1669
|
+
/** Items paired with one of the other form. */
|
|
1670
|
+
paired: number;
|
|
1671
|
+
/** Paired slots whose structure differs. */
|
|
1672
|
+
structureMismatches: number;
|
|
1673
|
+
};
|
|
1606
1674
|
}
|
|
1607
1675
|
/** What `createDraft` hands an activity type's `authoring.createDraft`. */
|
|
1608
1676
|
interface DraftContext {
|
|
@@ -1614,8 +1682,6 @@ interface DraftContext {
|
|
|
1614
1682
|
*/
|
|
1615
1683
|
newId: () => string;
|
|
1616
1684
|
}
|
|
1617
|
-
//#endregion
|
|
1618
|
-
//#region src/types/item-group.d.ts
|
|
1619
1685
|
/** What a stimulus primarily is. Drives validation and layout, never scoring. */
|
|
1620
1686
|
type StimulusKind = 'text' | 'audio' | 'video' | 'image' | 'mixed';
|
|
1621
1687
|
/**
|
|
@@ -1834,8 +1900,6 @@ interface SequenceSlot<TItem = ActivityData> {
|
|
|
1834
1900
|
/** Present when the slot comes from an item group. */
|
|
1835
1901
|
group?: SequenceSlotGroup;
|
|
1836
1902
|
}
|
|
1837
|
-
//#endregion
|
|
1838
|
-
//#region src/types/ai.d.ts
|
|
1839
1903
|
/**
|
|
1840
1904
|
* What an author allows AI to do for one item. Absent, or a feature left out,
|
|
1841
1905
|
* leaves the choice to the deployment. `false` switches a feature off for this
|
|
@@ -1903,6 +1967,11 @@ interface AiOptionFact {
|
|
|
1903
1967
|
}
|
|
1904
1968
|
interface AiMultipleChoiceFacts extends AiFactsBase {
|
|
1905
1969
|
activityType: 'multiple-choice';
|
|
1970
|
+
/**
|
|
1971
|
+
* The item's instructions, when it has any: the task the learner reads
|
|
1972
|
+
* before the question. They say what to do, and are never part of the text answered.
|
|
1973
|
+
*/
|
|
1974
|
+
instructions?: string;
|
|
1906
1975
|
question: string;
|
|
1907
1976
|
mode: 'single' | 'multi';
|
|
1908
1977
|
options: AiOptionFact[];
|
|
@@ -1925,6 +1994,11 @@ interface AiBlankFact {
|
|
|
1925
1994
|
}
|
|
1926
1995
|
interface AiFillInTheBlanksFacts extends AiFactsBase {
|
|
1927
1996
|
activityType: 'fill-in-the-blanks';
|
|
1997
|
+
/**
|
|
1998
|
+
* The item's instructions, when it has any: the task the learner reads
|
|
1999
|
+
* before the passage. They say what to do, and are never part of the text answered.
|
|
2000
|
+
*/
|
|
2001
|
+
instructions?: string;
|
|
1928
2002
|
/** The passage, each blank written as `[1]`, `[2]`… in passage order. */
|
|
1929
2003
|
passage: string;
|
|
1930
2004
|
blanks: AiBlankFact[];
|
|
@@ -1947,6 +2021,11 @@ interface AiGapFact {
|
|
|
1947
2021
|
}
|
|
1948
2022
|
interface AiGapSelectFacts extends AiFactsBase {
|
|
1949
2023
|
activityType: 'gap-select';
|
|
2024
|
+
/**
|
|
2025
|
+
* The item's instructions, when it has any: the task the learner reads
|
|
2026
|
+
* before the passage. They say what to do, and are never part of the text answered.
|
|
2027
|
+
*/
|
|
2028
|
+
instructions?: string;
|
|
1950
2029
|
/** The passage, each gap written as `[1]`, `[2]`… in passage order. */
|
|
1951
2030
|
passage: string;
|
|
1952
2031
|
gaps: AiGapFact[];
|
|
@@ -2647,6 +2726,245 @@ interface AiVideoDraft {
|
|
|
2647
2726
|
/** What `critiqueItemGroupDraft` says of it. */
|
|
2648
2727
|
findings: ItemFinding[];
|
|
2649
2728
|
}
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2729
|
+
/**
|
|
2730
|
+
* How hard a variant is meant to be next to its exemplar: one step, inside the
|
|
2731
|
+
* level, never another level. `same` is a parallel form. The SDK cannot
|
|
2732
|
+
* measure difficulty: this is an instruction to the model, and item statistics
|
|
2733
|
+
* after delivery are the measurement.
|
|
2734
|
+
*/
|
|
2735
|
+
type AiVariantDifficulty = 'easier' | 'same' | 'harder';
|
|
2736
|
+
/**
|
|
2737
|
+
* What the level covers, from the host's curriculum: grammar and vocabulary a
|
|
2738
|
+
* learner has been taught, and topics to keep away from. Told to the model;
|
|
2739
|
+
* the SDK does not check vocabulary.
|
|
2740
|
+
*/
|
|
2741
|
+
interface AiVariantLevelFacts {
|
|
2742
|
+
grammar?: string[];
|
|
2743
|
+
vocabulary?: string[];
|
|
2744
|
+
avoidTopics?: string[];
|
|
2745
|
+
}
|
|
2746
|
+
/** Why `aiVariantsRequest` left an exemplar out: it cannot yield a sound variant. */
|
|
2747
|
+
type AiVariantSkipCode = 'variant_exemplar_unheard' | 'variant_exemplar_unseen' | 'variant_exemplar_incomplete' | 'variant_exemplar_timeline' | 'variant_exemplar_unsupported' | 'variant_exemplar_too_long';
|
|
2748
|
+
/** An exemplar left out of the facts, and why. The host keeps it, or asks a person. */
|
|
2749
|
+
interface AiVariantSkip {
|
|
2750
|
+
/** Its index in the exemplars passed. */
|
|
2751
|
+
exemplarIndex: number;
|
|
2752
|
+
code: AiVariantSkipCode;
|
|
2753
|
+
message: string;
|
|
2754
|
+
}
|
|
2755
|
+
/**
|
|
2756
|
+
* What a variant must meet, computed from its exemplar, so that what the model
|
|
2757
|
+
* is told and what `checkAiVariants` checks are one thing.
|
|
2758
|
+
*/
|
|
2759
|
+
interface AiVariantTargets {
|
|
2760
|
+
/** The exemplar's type: an activity type, or `item-group`. */
|
|
2761
|
+
type: string;
|
|
2762
|
+
/**
|
|
2763
|
+
* The counts to keep: `{ mode: 'single', options: 4, correct: 1 }`,
|
|
2764
|
+
* `{ blanks: [{ oneWord: true, acceptedAnswers: [1, 3] }] }`,
|
|
2765
|
+
* `{ gaps: [{ bank: 0 }, …], banks: [{ choices: 7 }] }`,
|
|
2766
|
+
* `{ stimulus: 'audio', items: ['multiple-choice', …], speakers: 2, turns: [5, 8] }`.
|
|
2767
|
+
*/
|
|
2768
|
+
structure: Readonly<Record<string, unknown>>;
|
|
2769
|
+
/** Inclusive bounds, in words, for each text written: `{ 'stimulus.body': [162, 198], question: [6, 14] }`. */
|
|
2770
|
+
lengths: Readonly<Record<string, [number, number]>>;
|
|
2771
|
+
difficulty: AiVariantDifficulty;
|
|
2772
|
+
/** Why this item moves, in the host's words. Present only when `difficulty` is not `same`. */
|
|
2773
|
+
difficultyReason?: string;
|
|
2774
|
+
/** The ways this type is made easier or harder, as sentences. Present only when `difficulty` is not `same`. */
|
|
2775
|
+
levers?: string[];
|
|
2776
|
+
/**
|
|
2777
|
+
* For an item group whose items do not all move alike (`difficultyFor`
|
|
2778
|
+
* names some of them): each item's own difficulty, by its index in `items`.
|
|
2779
|
+
*/
|
|
2780
|
+
itemDifficulty?: {
|
|
2781
|
+
item: number;
|
|
2782
|
+
difficulty: AiVariantDifficulty;
|
|
2783
|
+
difficultyReason?: string;
|
|
2784
|
+
levers?: string[];
|
|
2785
|
+
}[];
|
|
2786
|
+
/** What the item critic finds in the exemplar: flaws the variant must not repeat. */
|
|
2787
|
+
exemplarFindings: {
|
|
2788
|
+
code: string;
|
|
2789
|
+
message: string;
|
|
2790
|
+
}[];
|
|
2791
|
+
}
|
|
2792
|
+
/** One exemplar as a model is given it. */
|
|
2793
|
+
interface AiVariantExemplarFacts {
|
|
2794
|
+
/** Its index in the exemplars passed: what the variant names as its `exemplar`. */
|
|
2795
|
+
exemplar: number;
|
|
2796
|
+
type: string;
|
|
2797
|
+
/**
|
|
2798
|
+
* The exemplar in the shape a variant is written in: every word a learner
|
|
2799
|
+
* reads or hears, which options are right, and each blank's answers. No ids,
|
|
2800
|
+
* HTML, settings or addresses.
|
|
2801
|
+
*/
|
|
2802
|
+
content: Readonly<Record<string, unknown>>;
|
|
2803
|
+
/** What it tests, when the author said: the variant tests the same. */
|
|
2804
|
+
learningObjectives?: string[];
|
|
2805
|
+
targets: AiVariantTargets;
|
|
2806
|
+
}
|
|
2807
|
+
/**
|
|
2808
|
+
* A picture an exemplar shows, for a host that attaches pictures to its call:
|
|
2809
|
+
* in exemplar order, each with the `ref` the facts name it by.
|
|
2810
|
+
*/
|
|
2811
|
+
interface AiVariantImage {
|
|
2812
|
+
ref: string;
|
|
2813
|
+
exemplarIndex: number;
|
|
2814
|
+
/** Where the picture is, from the exemplar. */
|
|
2815
|
+
path: string[];
|
|
2816
|
+
alt?: string;
|
|
2817
|
+
url: string;
|
|
2818
|
+
}
|
|
2819
|
+
/**
|
|
2820
|
+
* What a host's model is given to write variants of existing items: built by
|
|
2821
|
+
* `aiVariantsRequest`, and by `aiVariantsRepairRequest` for a second pass.
|
|
2822
|
+
*
|
|
2823
|
+
* Only `feature`, `facts`, `shape` and, on a repair, `repair` are for the
|
|
2824
|
+
* model. The rest is for `checkAiVariants`: the exemplars and the other forms
|
|
2825
|
+
* as passed — answer keys and addresses included — and the host's settings.
|
|
2826
|
+
*/
|
|
2827
|
+
interface AiVariantsRequest {
|
|
2828
|
+
feature: 'variant-generation';
|
|
2829
|
+
facts: {
|
|
2830
|
+
/** One per exemplar that can be varied, in paper order. One variant is written for each. */
|
|
2831
|
+
exemplars: AiVariantExemplarFacts[];
|
|
2832
|
+
/** The level, as the host names it (`CEFR B1`): every variant stays inside it. */
|
|
2833
|
+
level: string;
|
|
2834
|
+
locale?: string;
|
|
2835
|
+
/** The default for every exemplar; each one's `targets.difficulty` says its own. */
|
|
2836
|
+
difficulty: AiVariantDifficulty;
|
|
2837
|
+
levelFacts?: AiVariantLevelFacts;
|
|
2838
|
+
/**
|
|
2839
|
+
* What happens to a picture: `describe` — the variant describes a new one
|
|
2840
|
+
* in its `alt`, for a person to find or commission; `reuse` — the variant
|
|
2841
|
+
* keeps the exemplar's and asks new questions about it.
|
|
2842
|
+
*/
|
|
2843
|
+
imagePolicy: 'describe' | 'reuse';
|
|
2844
|
+
/** Every picture the exemplars show, for a host that attaches them. Absent when there are none. */
|
|
2845
|
+
images?: AiVariantImage[];
|
|
2846
|
+
/**
|
|
2847
|
+
* The other forms' items, as their texts and right answers: what a variant
|
|
2848
|
+
* must not resemble. Absent when the host passed none.
|
|
2849
|
+
*/
|
|
2850
|
+
avoid?: {
|
|
2851
|
+
texts: string[];
|
|
2852
|
+
keys: string[];
|
|
2853
|
+
}[];
|
|
2854
|
+
/** The author's words to the model, as they are. */
|
|
2855
|
+
instructions?: string;
|
|
2856
|
+
/** What every variant must respect, as sentences a prompt can quote. */
|
|
2857
|
+
rules: string[];
|
|
2858
|
+
};
|
|
2859
|
+
/** The JSON Schema of a reply — `{ variants: [...] }` — one per exemplar in the facts. */
|
|
2860
|
+
shape: Readonly<Record<string, unknown>>;
|
|
2861
|
+
/** The exemplars as passed. Not for the model: it holds answer keys and addresses. */
|
|
2862
|
+
exemplars: readonly unknown[];
|
|
2863
|
+
/** The other forms as passed. Not for the model. */
|
|
2864
|
+
avoid?: readonly unknown[];
|
|
2865
|
+
/** The host's settings for every variant of a type. Not for the model. */
|
|
2866
|
+
settings?: AiDraftSettings;
|
|
2867
|
+
/** The host's length ratios, overriding `AI_VARIANT_LENGTH_BANDS`. Not for the model. */
|
|
2868
|
+
lengthTolerance?: {
|
|
2869
|
+
material?: number;
|
|
2870
|
+
item?: number;
|
|
2871
|
+
};
|
|
2872
|
+
/** Spread single-answer keys across positions, from this seed. Not for the model. */
|
|
2873
|
+
balanceKeyPositions?: {
|
|
2874
|
+
seed: string;
|
|
2875
|
+
};
|
|
2876
|
+
/** The exemplars that cannot be varied, and why. */
|
|
2877
|
+
skipped: AiVariantSkip[];
|
|
2878
|
+
/**
|
|
2879
|
+
* On a repair: what to write again, each with the problems the model can
|
|
2880
|
+
* fix — `variant` absent for one the model did not write. The reply holds
|
|
2881
|
+
* one variant for each, naming its exemplar.
|
|
2882
|
+
*/
|
|
2883
|
+
repair?: {
|
|
2884
|
+
exemplar: number;
|
|
2885
|
+
variant?: Readonly<Record<string, unknown>>;
|
|
2886
|
+
problems: AiDraftProblem[];
|
|
2887
|
+
}[];
|
|
2888
|
+
}
|
|
2889
|
+
/**
|
|
2890
|
+
* Why a variant is not a parallel item of its exemplar: `variant_type` — not
|
|
2891
|
+
* its type; `variant_structure` — a count a learner answers, or a setting that
|
|
2892
|
+
* scores it, differs. Always `invalid`, and repairable.
|
|
2893
|
+
*/
|
|
2894
|
+
interface AiVariantMismatch {
|
|
2895
|
+
path: string[];
|
|
2896
|
+
message: string;
|
|
2897
|
+
code: 'variant_type' | 'variant_structure';
|
|
2898
|
+
severity: 'invalid';
|
|
2899
|
+
}
|
|
2900
|
+
/** An exemplar the reply wrote no variant for. Invalid, and repairable. */
|
|
2901
|
+
interface AiVariantMissing {
|
|
2902
|
+
exemplarIndex: number;
|
|
2903
|
+
code: 'variant_missing';
|
|
2904
|
+
message: string;
|
|
2905
|
+
severity: 'invalid';
|
|
2906
|
+
}
|
|
2907
|
+
/**
|
|
2908
|
+
* One item of an exemplar and the variant's item in its place, by path from
|
|
2909
|
+
* each entry (`[]` for a loose activity or a group, `['items', '2']` for an
|
|
2910
|
+
* item in it) and by id: what lines up one form's slot with another's when
|
|
2911
|
+
* the content has no `slotKey`.
|
|
2912
|
+
*/
|
|
2913
|
+
interface AiVariantPair {
|
|
2914
|
+
exemplarPath: string[];
|
|
2915
|
+
variantPath: string[];
|
|
2916
|
+
exemplarId: string;
|
|
2917
|
+
variantId: string;
|
|
2918
|
+
}
|
|
2919
|
+
/** A variant as the SDK made it from a reply: copied fields put back, ids minted, checked and compared. */
|
|
2920
|
+
interface AiGeneratedVariant {
|
|
2921
|
+
/** Its exemplar's index in the exemplars passed. */
|
|
2922
|
+
exemplarIndex: number;
|
|
2923
|
+
/** The exemplar's type: an activity type, or `item-group`. */
|
|
2924
|
+
type: string;
|
|
2925
|
+
/** The variant: a sequence entry once `status` is `complete`. */
|
|
2926
|
+
entry: Record<string, unknown>;
|
|
2927
|
+
/**
|
|
2928
|
+
* `invalid` when `validation` is, or a mismatch says so; else `incomplete`
|
|
2929
|
+
* when `validation` is; else `complete`. A recording, or a picture to
|
|
2930
|
+
* describe, comes back with no file — `media_url_required`, so `incomplete`
|
|
2931
|
+
* — until the host attaches one.
|
|
2932
|
+
*/
|
|
2933
|
+
status: 'complete' | 'incomplete' | 'invalid';
|
|
2934
|
+
/** What `validateDraft`, or `validateItemGroupDraft`, says of it. */
|
|
2935
|
+
validation: DraftValidationResult<unknown>;
|
|
2936
|
+
/** How it fails to be parallel to its exemplar. */
|
|
2937
|
+
mismatches: AiVariantMismatch[];
|
|
2938
|
+
/** What the item critic finds, then `variant_length`, `variant_near_copy` and `variant_same_key`. */
|
|
2939
|
+
findings: ItemFinding[];
|
|
2940
|
+
/** Each item of the exemplar with the variant's item in its place. */
|
|
2941
|
+
pairs: AiVariantPair[];
|
|
2942
|
+
/** The variant as the model wrote it, for a repair. */
|
|
2943
|
+
generated: Readonly<Record<string, unknown>>;
|
|
2944
|
+
}
|
|
2945
|
+
/** What `checkAiVariants` makes of a reply. */
|
|
2946
|
+
interface AiVariants {
|
|
2947
|
+
/** The variants the reply wrote, in exemplar order. */
|
|
2948
|
+
variants: AiGeneratedVariant[];
|
|
2949
|
+
/** The exemplars it wrote none for. */
|
|
2950
|
+
missing: AiVariantMissing[];
|
|
2951
|
+
/** What only the set shows, over the variants as returned: the paper codes of `critiqueDrafts`. */
|
|
2952
|
+
findings: ItemFinding[];
|
|
2953
|
+
provenance?: AiProvenance;
|
|
2954
|
+
usage?: GraderUsage;
|
|
2955
|
+
}
|
|
2956
|
+
/** What `generateVariants` came to. */
|
|
2957
|
+
interface AiVariantsRun {
|
|
2958
|
+
/** The best pass of each variant, in exemplar order. */
|
|
2959
|
+
variants: AiGeneratedVariant[];
|
|
2960
|
+
/** The exemplars no pass wrote a variant for. */
|
|
2961
|
+
missing: AiVariantMissing[];
|
|
2962
|
+
/** What only the set shows, over the variants as they ended. */
|
|
2963
|
+
findings: ItemFinding[];
|
|
2964
|
+
/** The exemplars that could not be varied, and why. */
|
|
2965
|
+
skipped: AiVariantSkip[];
|
|
2966
|
+
/** Every call, in order: the first, then each repair. */
|
|
2967
|
+
calls: AiDraftsCall[];
|
|
2968
|
+
}
|
|
2969
|
+
export { AiTextResult as $, GradeRoutingReason as $n, DictationEquivalence as $t, AiGapSelectFacts as A, ScoringOutcome as An, TimelineCue as At, AiGroupInput as B, XAPIActor as Bn, VersionFinding as Bt, AiDraftsCall as C, ReadAloudDimension as Cn, MediaTimeline as Ct, AiFeature as D, RecordingBounds as Dn, Stimulus as Dt, AiExplanationRequest as E, ReadAloudSlowMedia as En, SequenceSlotGroup as Et, AiGradingCriterionFact as F, WrittenResponseData as Fn, DraftSeverity as Ft, AiOptionFact as G, XAPIObject as Gn, ActivityFeedback as Gt, AiItemFacts as H, XAPIContext as Hn, VersionSlot as Ht, AiGradingFacts as I, WrittenResponseLearnerResponse as In, DraftValidationResult as It, AiReadingWordFact as J, XAPIStatement as Jn, ActivityType as Jt, AiProvenance as K, XAPIResult as Kn, ActivityMedia as Kt, AiGradingJudgement as L, WrittenResponseRubric as Ln, ItemFinding as Lt, AiGeneratedVariant as M, ScriptTurn as Mn, DraftContext as Mt, AiGrade as N, ValidationError as Nn, DraftIssue as Nt, AiFillInTheBlanksFacts as O, RecordingRef as On, StimulusKind as Ot, AiGradedCriterion as P, ValidationResult as Pn, DraftNotComplete as Pt, AiSupportedActivityType as Q, GradeRouting as Qn, DictationData as Qt, AiGradingRequest as R, WrittenResponseRubricCriterion as Rn, ItemFindingSeverity as Rt, AiDrafts as S, ReadAloudData as Sn, MediaProgress as St, AiDraftsRun as T, ReadAloudLearnerResponse as Tn, SequenceSlot as Tt, AiMaterialFacts as U, XAPIContextActivities as Un, ActivityData as Ut, AiHintRequest as V, XAPIConfig as Vn, VersionPaper as Vt, AiMultipleChoiceFacts as W, XAPIError as Wn, ActivityDataMap as Wt, AiRubricCriterionFact as X, CriterionScore as Xn, DeferredReason as Xt, AiRefusal as Y, XAPIVerbObject as Yn, BlankConfig as Yt, AiSoundFact as Z, GradeRecord as Zn, DeferredScoringPartial as Zt, AiDraftCaption as _, MultipleChoiceData as _n, AiWritingFacts as _t, AiCoachingRequest as a, GapSelectBank as an, InlineCorrection as ar, AiVariantMissing as at, AiDraftSource as b, MultipleChoiceOptionMedia as bn, AiWritingFeedbackResult as bt, AiCriterionJudgement as c, GapSelectGap as cn, levenshteinDistance as cr, AiVariantSkipCode as ct, AiCritiqueFinding as d, InteractionKind as dn, AiVariantsRequest as dt, DictationLearnerResponse as en, Grader as er, AiVariantDifficulty as et, AiCritiqueFindingResult as f, ItemOutcome as fn, AiVariantsRun as ft, AiDictationFacts as g, MediaTrack as gn, AiWritingCorrection as gt, AiCritiqueResult as h, MediaPlaybackPolicy as hn, AiWordFact as ht, AiCoaching as i, FillInTheBlanksLearnerResponse as in, GradingState as ir, AiVariantMismatch as it, AiGeneratedDraft as j, ScoringResult as jn, DraftComplete as jt, AiGapFact as k, ScoringDetail as kn, TimelineChapter as kt, AiCritique as l, GapSelectLearnerResponse as ln, matchText as lr, AiVariantTargets as lt, AiCritiqueRequest as m, LearnerResponseMap as mn, AiVideoDraft as mt, AiActivityInput as n, DictationTolerance as nn, GraderKind as nr, AiVariantImage as nt, AiCoachingResult as o, GapSelectChoice as on, TextMatchPolicy as or, AiVariantPair as ot, AiCritiqueKind as p, LearnerResponse as pn, AiVerdict as pt, AiReadingFacts as q, XAPIScore as qn, ActivityResult as qt, AiBlankFact as r, FillInTheBlanksData as rn, GraderUsage as rr, AiVariantLevelFacts as rt, AiCoachingWord as s, GapSelectData as sn, TextMatchResult as sr, AiVariantSkip as st, ActivityAiPermissions as t, DictationSlowMedia as tn, GraderConfiguration as tr, AiVariantExemplarFacts as tt, AiCritiqueField as u, InteractionEvent as un, AiVariants as ut, AiDraftProblem as v, MultipleChoiceLearnerResponse as vn, AiWritingFeedback as vt, AiDraftsRequest as w, ReadAloudDimensionWeight as wn, SequenceEntry as wt, AiDraftType as x, NativeControlHint as xn, ItemGroup as xt, AiDraftSettings as y, MultipleChoiceOption as yn, AiWritingFeedbackRequest as yt, AiGradingRequestProblem as z, WrittenResponseRubricLevel as zn, VersionComparison as zt };
|
|
2970
|
+
//# sourceMappingURL=ai-Cnm0qE8v.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-Cnm0qE8v.d.ts","names":[],"sources":["../src/scoring/text-match.ts","../src/types/grading.ts","../src/types/xapi.ts","../src/types/activity.ts","../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OAAO;;EAEP,WAAW,SAAS;;;UAIL;;EAEf,UAAU;;EAEV,SAAS;;EAET,UAAU;EACV,aAAa;EACb,QAAQ;;;UAIO;;EAEf,UAAU;;EAEV,SAAS;;EAET,UAAU;;EAEV,SAAS;;EAET,OAAO"}
|
package/dist/ai-check.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ai_writing = require("./ai-writing-
|
|
3
|
-
const require_scoring = require("./scoring-
|
|
4
|
-
|
|
2
|
+
const require_ai_writing = require("./ai-writing-Bh2Y53cY.cjs");
|
|
3
|
+
const require_scoring = require("./scoring-D9tFvPEG.cjs");
|
|
4
|
+
// src/ai-check/cases.ts
|
|
5
5
|
/**
|
|
6
6
|
* The items the cases are built from. Small, ordinary language-course content
|
|
7
7
|
* — and deliberately awkward in the places a model slips:
|
|
@@ -18,6 +18,8 @@ const require_scoring = require("./scoring-CaPS6q8b.cjs");
|
|
|
18
18
|
* - questions in item groups: a reading passage that prints a question's
|
|
19
19
|
* answer, which a hint must point to without quoting, and a run of blanks
|
|
20
20
|
* whose instructions only the group states;
|
|
21
|
+
* - the same blank served alone, as an adaptive test serves it, whose task
|
|
22
|
+
* only its own instructions state;
|
|
21
23
|
* - essays to grade on a rubric of three criteria, two judged on levels and
|
|
22
24
|
* one on a score, so a grade that drops a criterion or leaves a scale is
|
|
23
25
|
* caught.
|
|
@@ -181,6 +183,12 @@ const formationPart = {
|
|
|
181
183
|
},
|
|
182
184
|
items: [formation]
|
|
183
185
|
};
|
|
186
|
+
/** The same blank served alone, as an adaptive test serves it: the task is in its own instructions. */
|
|
187
|
+
const formationAlone = {
|
|
188
|
+
...formation,
|
|
189
|
+
id: "ai-check-formation-alone",
|
|
190
|
+
instructions: "Use the word in capitals at the end of the sentence to form a word that fits the gap."
|
|
191
|
+
};
|
|
184
192
|
const weekend = {
|
|
185
193
|
schemaVersion: "1.0",
|
|
186
194
|
type: "written-response",
|
|
@@ -548,6 +556,49 @@ function draftsCase(id, about, types, source, extra = {}) {
|
|
|
548
556
|
request
|
|
549
557
|
};
|
|
550
558
|
}
|
|
559
|
+
/** Builds a variants case, failing loudly rather than shipping one with nothing to vary. */
|
|
560
|
+
function variantsCase(id, about, exemplars, extra = {}) {
|
|
561
|
+
const request = require_ai_writing.aiVariantsRequest({
|
|
562
|
+
exemplars,
|
|
563
|
+
level: "CEFR A2",
|
|
564
|
+
...extra
|
|
565
|
+
});
|
|
566
|
+
if (request.facts.exemplars.length !== exemplars.length) throw new Error(`ai-check: an exemplar of "${id}" cannot be varied`);
|
|
567
|
+
return {
|
|
568
|
+
id,
|
|
569
|
+
feature: "variant-generation",
|
|
570
|
+
about,
|
|
571
|
+
request
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
/** A text everyone has read: a model is tempted to copy it rather than write a parallel one. */
|
|
575
|
+
const famous = {
|
|
576
|
+
schemaVersion: "1.0",
|
|
577
|
+
type: "read-aloud",
|
|
578
|
+
id: "ai-check-famous",
|
|
579
|
+
title: "Read the opening aloud",
|
|
580
|
+
referenceText: "It was the best of times, it was the worst of times, it was the age of wisdom.",
|
|
581
|
+
locale: "en-US",
|
|
582
|
+
recording: { maxSeconds: 20 },
|
|
583
|
+
scoring: { dimensions: [{
|
|
584
|
+
name: "accuracy",
|
|
585
|
+
weight: 1
|
|
586
|
+
}] }
|
|
587
|
+
};
|
|
588
|
+
/** A grammar item whose only natural answer, in any parallel sentence, is the same word. */
|
|
589
|
+
const secondConditional = {
|
|
590
|
+
schemaVersion: "1.0",
|
|
591
|
+
type: "fill-in-the-blanks",
|
|
592
|
+
id: "ai-check-second-conditional",
|
|
593
|
+
title: "If I were you",
|
|
594
|
+
instructions: "Complete the sentence. Use ONE word.",
|
|
595
|
+
passage: "If I {{be}} you, I would take the early train tomorrow.",
|
|
596
|
+
blanks: [{
|
|
597
|
+
id: "be",
|
|
598
|
+
acceptedAnswers: ["were"]
|
|
599
|
+
}],
|
|
600
|
+
scoringStrategy: "all-or-nothing"
|
|
601
|
+
};
|
|
551
602
|
/**
|
|
552
603
|
* What a host sets on every read-aloud it drafts: the SDK has no default for a
|
|
553
604
|
* recording's length or the dimensions a reading is graded on.
|
|
@@ -706,6 +757,7 @@ function aiCheckCases() {
|
|
|
706
757
|
hintCase("gap-hint-2", "Asked again with the first gap wrong", landscape, picked({ g1: "campo" }), ["Piensa en la forma del terreno."]),
|
|
707
758
|
hintCase("mc-reading-hint", "Has not answered a question whose answer its group's passage prints", springTides, chose([]), [], tides),
|
|
708
759
|
hintCase("fib-formation-hint", "A word-formation blank, under the instructions its group gives", formation, typed({}), [], formationPart),
|
|
760
|
+
hintCase("fib-instructions-hint", "The same blank served alone, under its own instructions", formationAlone, typed({})),
|
|
709
761
|
writingCase("writing-mistakes", "A first draft with tense, article and agreement mistakes", "Last weekend I go to the market and buyed a apple. My friends was there too, so we don't go home early. Then I go to the cinema."),
|
|
710
762
|
writingCase("writing-clean", "A first draft with no mistakes to correct", "Last weekend I went to the market and bought an apple. My friends were there too, so we stayed until the evening. Then we went to the cinema."),
|
|
711
763
|
writingCase("writing-revised", "A second draft that fixed some mistakes", "Last weekend I went to the market and bought a apple. My friends was there too, so we didn't go home early.", ["Check your past tenses: \"go\" and \"buyed\" should be past forms."]),
|
|
@@ -790,11 +842,27 @@ function aiCheckCases() {
|
|
|
790
842
|
data: tidesSummaryExam,
|
|
791
843
|
group: tidesExam
|
|
792
844
|
}),
|
|
793
|
-
gradingCase("grading-in-spanish", "The essay with mistakes, with comments asked for in Spanish", "Last weekend I go to the market and buyed a apple. My friends was there too, so we don't go home early. Then I go to the cinema.", { learnerLocale: "es" })
|
|
845
|
+
gradingCase("grading-in-spanish", "The essay with mistakes, with comments asked for in Spanish", "Last weekend I go to the market and buyed a apple. My friends was there too, so we don't go home early. Then I go to the cinema.", { learnerLocale: "es" }),
|
|
846
|
+
variantsCase("variants-choice", "A parallel version of a multiple choice", [capital]),
|
|
847
|
+
variantsCase("variants-cloze", "A parallel version of a fill-in-the-blanks", [introduction]),
|
|
848
|
+
variantsCase("variants-gaps", "A parallel version of a gap select", [landscape]),
|
|
849
|
+
variantsCase("variants-dictation", "A parallel version of a dictation", [listening]),
|
|
850
|
+
variantsCase("variants-read-aloud", "A parallel version of a text to read aloud", [weather]),
|
|
851
|
+
variantsCase("variants-writing", "A parallel version of a writing task", [weekend]),
|
|
852
|
+
variantsCase("variants-reading", "A parallel reading part: a new passage and its questions", [tides]),
|
|
853
|
+
variantsCase("variants-section", "A parallel section, harder by one step, with its keys spread", [
|
|
854
|
+
capital,
|
|
855
|
+
introduction,
|
|
856
|
+
landscape
|
|
857
|
+
], {
|
|
858
|
+
difficulty: "harder",
|
|
859
|
+
balanceKeyPositions: { seed: "ai-check" }
|
|
860
|
+
}),
|
|
861
|
+
variantsCase("variants-famous", "A parallel version of a famous opening line", [famous]),
|
|
862
|
+
variantsCase("variants-grammar-key", "A parallel grammar item whose natural answer is the same word", [secondConditional])
|
|
794
863
|
];
|
|
795
864
|
}
|
|
796
|
-
|
|
797
|
-
//#region src/ai-check/index.ts
|
|
865
|
+
// src/ai-check/index.ts
|
|
798
866
|
/**
|
|
799
867
|
* A test kit for the prompts behind your AI ports.
|
|
800
868
|
*
|
|
@@ -861,6 +929,7 @@ function portFor(ports, one) {
|
|
|
861
929
|
case "pronunciation-coaching": return ports.pronunciationCoaching;
|
|
862
930
|
case "item-critique": return ports.critique;
|
|
863
931
|
case "draft-generation": return ports.drafts;
|
|
932
|
+
case "variant-generation": return ports.variants;
|
|
864
933
|
case "grading": return ports.grading;
|
|
865
934
|
default: return ports.writingFeedback;
|
|
866
935
|
}
|
|
@@ -906,6 +975,19 @@ async function runCase(ports, one) {
|
|
|
906
975
|
ms
|
|
907
976
|
} : refused(one, raw, checked.refusal, ms);
|
|
908
977
|
}
|
|
978
|
+
if (one.request.feature === "variant-generation") {
|
|
979
|
+
let next = 0;
|
|
980
|
+
const checked = require_ai_writing.checkAiVariants(raw, one.request, { newId: () => {
|
|
981
|
+
next += 1;
|
|
982
|
+
return `ai-check-${next}`;
|
|
983
|
+
} });
|
|
984
|
+
return checked.ok ? {
|
|
985
|
+
case: one,
|
|
986
|
+
ok: true,
|
|
987
|
+
variants: checked.variants,
|
|
988
|
+
ms
|
|
989
|
+
} : refused(one, raw, checked.refusal, ms);
|
|
990
|
+
}
|
|
909
991
|
if (one.request.feature === "item-critique") {
|
|
910
992
|
const checked = require_ai_writing.checkAiCritique(raw, one.request);
|
|
911
993
|
return checked.ok ? {
|
|
@@ -1037,7 +1119,6 @@ function formatAiCheckReport(report) {
|
|
|
1037
1119
|
}
|
|
1038
1120
|
return lines.join("\n");
|
|
1039
1121
|
}
|
|
1040
|
-
//#endregion
|
|
1041
1122
|
exports.aiCheckCases = aiCheckCases;
|
|
1042
1123
|
exports.formatAiCheckReport = formatAiCheckReport;
|
|
1043
1124
|
exports.runAiCheck = runAiCheck;
|