@speakableio/core 1.0.32 → 1.0.34
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/index.native.js +41 -7
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +41 -7
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.web.js +41 -7
- package/dist/index.web.js.map +1 -1
- package/package.json +1 -1
package/dist/index.native.js
CHANGED
|
@@ -3680,11 +3680,45 @@ var useBaseOpenAI = ({
|
|
|
3680
3680
|
throw new Error(error);
|
|
3681
3681
|
}
|
|
3682
3682
|
};
|
|
3683
|
-
const
|
|
3684
|
-
|
|
3683
|
+
const onGetGeminiFeedback = async ({
|
|
3684
|
+
cardId,
|
|
3685
|
+
studentId,
|
|
3686
|
+
studentResponse
|
|
3687
|
+
}) => {
|
|
3688
|
+
var _a, _b;
|
|
3685
3689
|
try {
|
|
3686
3690
|
const getGeminiFeedback = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "callGetFeedback");
|
|
3687
|
-
|
|
3691
|
+
return await (getGeminiFeedback == null ? void 0 : getGeminiFeedback({
|
|
3692
|
+
cardId,
|
|
3693
|
+
studentId,
|
|
3694
|
+
studentResponse
|
|
3695
|
+
}));
|
|
3696
|
+
} catch (error) {
|
|
3697
|
+
console.error("Error getting Gemini feedback:", error);
|
|
3698
|
+
throw error;
|
|
3699
|
+
}
|
|
3700
|
+
};
|
|
3701
|
+
const onGetProficiencyEstimate = async ({
|
|
3702
|
+
cardId,
|
|
3703
|
+
studentId,
|
|
3704
|
+
studentResponse
|
|
3705
|
+
}) => {
|
|
3706
|
+
var _a, _b;
|
|
3707
|
+
try {
|
|
3708
|
+
const getProficiencyEstimate = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "getProficiencyEstimate");
|
|
3709
|
+
return await (getProficiencyEstimate == null ? void 0 : getProficiencyEstimate({
|
|
3710
|
+
cardId,
|
|
3711
|
+
studentId,
|
|
3712
|
+
studentResponse
|
|
3713
|
+
}));
|
|
3714
|
+
} catch (error) {
|
|
3715
|
+
console.error("Error getting proficiency estimate:", error);
|
|
3716
|
+
return {};
|
|
3717
|
+
}
|
|
3718
|
+
};
|
|
3719
|
+
const getAIResponse = async ({ cardId, transcript }) => {
|
|
3720
|
+
var _a;
|
|
3721
|
+
try {
|
|
3688
3722
|
const card = getCardFromCache({
|
|
3689
3723
|
cardId,
|
|
3690
3724
|
queryClient
|
|
@@ -3694,12 +3728,12 @@ var useBaseOpenAI = ({
|
|
|
3694
3728
|
if (card && card.grading_method === "manual") {
|
|
3695
3729
|
} else if (card && card.grading_method !== "standards_based") {
|
|
3696
3730
|
const [geminiResult, proficiencyResult] = await Promise.all([
|
|
3697
|
-
|
|
3731
|
+
onGetGeminiFeedback == null ? void 0 : onGetGeminiFeedback({
|
|
3698
3732
|
cardId,
|
|
3699
3733
|
studentId: currentUserId,
|
|
3700
3734
|
studentResponse: transcript
|
|
3701
3735
|
}),
|
|
3702
|
-
|
|
3736
|
+
onGetProficiencyEstimate == null ? void 0 : onGetProficiencyEstimate({
|
|
3703
3737
|
cardId,
|
|
3704
3738
|
studentId: currentUserId,
|
|
3705
3739
|
studentResponse: transcript
|
|
@@ -3707,12 +3741,12 @@ var useBaseOpenAI = ({
|
|
|
3707
3741
|
]);
|
|
3708
3742
|
proficiencyData = (proficiencyResult == null ? void 0 : proficiencyResult.data) || {};
|
|
3709
3743
|
feedbackData = {
|
|
3710
|
-
...(
|
|
3744
|
+
...(_a = geminiResult == null ? void 0 : geminiResult.data) != null ? _a : {},
|
|
3711
3745
|
// @ts-ignore
|
|
3712
3746
|
proficiency_level: (proficiencyData == null ? void 0 : proficiencyData.proficiency_level) || null
|
|
3713
3747
|
};
|
|
3714
3748
|
} else {
|
|
3715
|
-
const geminiResult = await (
|
|
3749
|
+
const geminiResult = await (onGetGeminiFeedback == null ? void 0 : onGetGeminiFeedback({
|
|
3716
3750
|
cardId,
|
|
3717
3751
|
studentId: currentUserId,
|
|
3718
3752
|
studentResponse: transcript
|