@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.
@@ -3568,11 +3568,45 @@ var useBaseOpenAI = ({
3568
3568
  throw new Error(error);
3569
3569
  }
3570
3570
  };
3571
- const getAIResponse = async ({ cardId, transcript }) => {
3572
- var _a, _b, _c, _d, _e;
3571
+ const onGetGeminiFeedback = async ({
3572
+ cardId,
3573
+ studentId,
3574
+ studentResponse
3575
+ }) => {
3576
+ var _a, _b;
3573
3577
  try {
3574
3578
  const getGeminiFeedback = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "callGetFeedback");
3575
- const getProficiencyEstimate = (_d = (_c = api).httpsCallable) == null ? void 0 : _d.call(_c, "getProficiencyEstimate");
3579
+ return await (getGeminiFeedback == null ? void 0 : getGeminiFeedback({
3580
+ cardId,
3581
+ studentId,
3582
+ studentResponse
3583
+ }));
3584
+ } catch (error) {
3585
+ console.error("Error getting Gemini feedback:", error);
3586
+ throw error;
3587
+ }
3588
+ };
3589
+ const onGetProficiencyEstimate = async ({
3590
+ cardId,
3591
+ studentId,
3592
+ studentResponse
3593
+ }) => {
3594
+ var _a, _b;
3595
+ try {
3596
+ const getProficiencyEstimate = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "getProficiencyEstimate");
3597
+ return await (getProficiencyEstimate == null ? void 0 : getProficiencyEstimate({
3598
+ cardId,
3599
+ studentId,
3600
+ studentResponse
3601
+ }));
3602
+ } catch (error) {
3603
+ console.error("Error getting proficiency estimate:", error);
3604
+ return {};
3605
+ }
3606
+ };
3607
+ const getAIResponse = async ({ cardId, transcript }) => {
3608
+ var _a;
3609
+ try {
3576
3610
  const card = getCardFromCache({
3577
3611
  cardId,
3578
3612
  queryClient
@@ -3582,12 +3616,12 @@ var useBaseOpenAI = ({
3582
3616
  if (card && card.grading_method === "manual") {
3583
3617
  } else if (card && card.grading_method !== "standards_based") {
3584
3618
  const [geminiResult, proficiencyResult] = await Promise.all([
3585
- getGeminiFeedback == null ? void 0 : getGeminiFeedback({
3619
+ onGetGeminiFeedback == null ? void 0 : onGetGeminiFeedback({
3586
3620
  cardId,
3587
3621
  studentId: currentUserId,
3588
3622
  studentResponse: transcript
3589
3623
  }),
3590
- getProficiencyEstimate == null ? void 0 : getProficiencyEstimate({
3624
+ onGetProficiencyEstimate == null ? void 0 : onGetProficiencyEstimate({
3591
3625
  cardId,
3592
3626
  studentId: currentUserId,
3593
3627
  studentResponse: transcript
@@ -3595,12 +3629,12 @@ var useBaseOpenAI = ({
3595
3629
  ]);
3596
3630
  proficiencyData = (proficiencyResult == null ? void 0 : proficiencyResult.data) || {};
3597
3631
  feedbackData = {
3598
- ...(_e = geminiResult == null ? void 0 : geminiResult.data) != null ? _e : {},
3632
+ ...(_a = geminiResult == null ? void 0 : geminiResult.data) != null ? _a : {},
3599
3633
  // @ts-ignore
3600
3634
  proficiency_level: (proficiencyData == null ? void 0 : proficiencyData.proficiency_level) || null
3601
3635
  };
3602
3636
  } else {
3603
- const geminiResult = await (getGeminiFeedback == null ? void 0 : getGeminiFeedback({
3637
+ const geminiResult = await (onGetGeminiFeedback == null ? void 0 : onGetGeminiFeedback({
3604
3638
  cardId,
3605
3639
  studentId: currentUserId,
3606
3640
  studentResponse: transcript