@sage-rsc/talking-head-react 1.0.38 → 1.0.40

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.js CHANGED
@@ -2734,9 +2734,9 @@ class Le {
2734
2734
  cameraPanEnable: !1,
2735
2735
  cameraZoomEnable: !1,
2736
2736
  lightAmbientColor: 16777215,
2737
- lightAmbientIntensity: 1.2,
2737
+ lightAmbientIntensity: 2,
2738
2738
  lightDirectColor: 8947882,
2739
- lightDirectIntensity: 18,
2739
+ lightDirectIntensity: 30,
2740
2740
  lightDirectPhi: 1,
2741
2741
  lightDirectTheta: 2,
2742
2742
  lightSpotIntensity: 0,
@@ -7206,16 +7206,12 @@ const $e = ye(({
7206
7206
  D ? u.current.speakText(R, {
7207
7207
  lipsyncLang: ne.lipsyncLang,
7208
7208
  onSpeechEnd: () => {
7209
- setTimeout(() => {
7210
- g.current && g.current();
7211
- }, 100);
7209
+ g.current && g.current();
7212
7210
  }
7213
7211
  }) : u.current.speakText(R, {
7214
7212
  lipsyncLang: ne.lipsyncLang,
7215
7213
  onSpeechEnd: () => {
7216
- setTimeout(() => {
7217
- I.current && I.current();
7218
- }, 100);
7214
+ I.current && I.current();
7219
7215
  }
7220
7216
  });
7221
7217
  }
@@ -7297,15 +7293,11 @@ const $e = ye(({
7297
7293
  type: "lessonStart",
7298
7294
  moduleIndex: l.current.currentModuleIndex,
7299
7295
  lessonIndex: l.current.currentLessonIndex
7300
- }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"), setTimeout(() => {
7301
- d.current && d.current();
7302
- }, 100))) : l.current.currentModuleIndex < (b.modules?.length || 0) - 1 ? (l.current.currentModuleIndex += 1, l.current.currentLessonIndex = 0, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0, c.current.onCustomAction({
7296
+ }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"), d.current && d.current())) : l.current.currentModuleIndex < (b.modules?.length || 0) - 1 ? (l.current.currentModuleIndex += 1, l.current.currentLessonIndex = 0, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0, c.current.onCustomAction({
7303
7297
  type: "lessonStart",
7304
7298
  moduleIndex: l.current.currentModuleIndex,
7305
7299
  lessonIndex: l.current.currentLessonIndex
7306
- }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"), setTimeout(() => {
7307
- d.current && d.current();
7308
- }, 100))) : I.current && I.current();
7300
+ }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"), d.current && d.current())) : I.current && I.current();
7309
7301
  }, []), V = M(() => {
7310
7302
  const b = v();
7311
7303
  let R = null;
@@ -7337,9 +7329,7 @@ const $e = ye(({
7337
7329
  }), u.current.speakText(R, {
7338
7330
  lipsyncLang: L.lipsyncLang,
7339
7331
  onSpeechEnd: () => {
7340
- l.current.isTeaching = !1, setTimeout(() => {
7341
- b.questions && b.questions.length > 0 ? H.current && H.current() : f.current && f.current();
7342
- }, 50);
7332
+ l.current.isTeaching = !1, b.questions && b.questions.length > 0 ? H.current && H.current() : f.current && f.current();
7343
7333
  }
7344
7334
  });
7345
7335
  }
@@ -7365,9 +7355,7 @@ const $e = ye(({
7365
7355
  u.current.speakText(L, {
7366
7356
  lipsyncLang: C.lipsyncLang,
7367
7357
  onSpeechEnd: () => {
7368
- setTimeout(() => {
7369
- x.current && x.current();
7370
- }, 50);
7358
+ x.current && x.current();
7371
7359
  }
7372
7360
  });
7373
7361
  } else {
@@ -7382,9 +7370,7 @@ const $e = ye(({
7382
7370
  u.current.speakText(L, {
7383
7371
  lipsyncLang: C.lipsyncLang,
7384
7372
  onSpeechEnd: () => {
7385
- setTimeout(() => {
7386
- x.current && x.current();
7387
- }, 50);
7373
+ x.current && x.current();
7388
7374
  }
7389
7375
  });
7390
7376
  }
@@ -7425,7 +7411,7 @@ const $e = ye(({
7425
7411
  const R = v(), w = R?.avatar_script || R?.body;
7426
7412
  h && w && setTimeout(() => {
7427
7413
  d.current && d.current();
7428
- }, 200);
7414
+ }, 50);
7429
7415
  }, [h, v]);
7430
7416
  Ce(() => {
7431
7417
  d.current = V, g.current = W, f.current = K, x.current = F, I.current = J, H.current = S, p.current = j;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sage-rsc/talking-head-react",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "description": "A reusable React component for 3D talking avatars with lip-sync and text-to-speech",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -213,13 +213,10 @@ const CurriculumLearning = forwardRef(({
213
213
  avatarRef.current.speakText(feedbackMessage, {
214
214
  lipsyncLang: config.lipsyncLang,
215
215
  onSpeechEnd: () => {
216
- // Add a small delay after speech ends for natural flow
217
- setTimeout(() => {
218
- // Use ref to avoid circular dependency
219
- if (nextLessonRef.current) {
220
- nextLessonRef.current();
221
- }
222
- }, 100);
216
+ // Immediately transition to next lesson with no delay
217
+ if (nextLessonRef.current) {
218
+ nextLessonRef.current();
219
+ }
223
220
  }
224
221
  });
225
222
  } else {
@@ -227,12 +224,10 @@ const CurriculumLearning = forwardRef(({
227
224
  avatarRef.current.speakText(feedbackMessage, {
228
225
  lipsyncLang: config.lipsyncLang,
229
226
  onSpeechEnd: () => {
230
- // Add a small delay after speech ends for natural flow
231
- setTimeout(() => {
232
- if (completeCurriculumRef.current) {
233
- completeCurriculumRef.current();
234
- }
235
- }, 100);
227
+ // Immediately complete curriculum with no delay
228
+ if (completeCurriculumRef.current) {
229
+ completeCurriculumRef.current();
230
+ }
236
231
  }
237
232
  });
238
233
  }
@@ -405,12 +400,10 @@ const CurriculumLearning = forwardRef(({
405
400
  avatarRef.current.setMood("happy");
406
401
  avatarRef.current.setBodyMovement("idle");
407
402
 
408
- // Automatically start teaching the next lesson after a brief pause
409
- setTimeout(() => {
403
+ // Immediately start teaching the next lesson
410
404
  if (startTeachingRef.current) {
411
405
  startTeachingRef.current();
412
406
  }
413
- }, 100);
414
407
  }
415
408
  } else {
416
409
  // No more lessons in current module - check if there's a next module
@@ -438,12 +431,10 @@ const CurriculumLearning = forwardRef(({
438
431
  avatarRef.current.setMood("happy");
439
432
  avatarRef.current.setBodyMovement("idle");
440
433
 
441
- // Automatically start teaching the next lesson after a brief pause
442
- setTimeout(() => {
434
+ // Immediately start teaching the next lesson
443
435
  if (startTeachingRef.current) {
444
436
  startTeachingRef.current();
445
437
  }
446
- }, 100);
447
438
  }
448
439
  } else {
449
440
  // No more modules or lessons - complete curriculum
@@ -514,20 +505,18 @@ const CurriculumLearning = forwardRef(({
514
505
  lipsyncLang: config.lipsyncLang,
515
506
  onSpeechEnd: () => {
516
507
  stateRef.current.isTeaching = false;
517
- // Add a small delay after speech ends for natural flow
518
- setTimeout(() => {
519
- if (currentLesson.questions && currentLesson.questions.length > 0) {
520
- // Use ref to avoid circular dependency
521
- if (startQuestionsRef.current) {
522
- startQuestionsRef.current();
508
+ // Immediately transition to next step with no delay
509
+ if (currentLesson.questions && currentLesson.questions.length > 0) {
510
+ // Use ref to avoid circular dependency
511
+ if (startQuestionsRef.current) {
512
+ startQuestionsRef.current();
523
513
  }
524
514
  } else {
525
- // No questions, complete the lesson using ref to avoid circular dependency
526
- if (completeLessonRef.current) {
527
- completeLessonRef.current();
528
- }
515
+ // No questions, complete the lesson using ref to avoid circular dependency
516
+ if (completeLessonRef.current) {
517
+ completeLessonRef.current();
529
518
  }
530
- }, 50);
519
+ }
531
520
  }
532
521
  });
533
522
  }
@@ -572,12 +561,10 @@ const CurriculumLearning = forwardRef(({
572
561
  avatarRef.current.speakText(successMessage, {
573
562
  lipsyncLang: config.lipsyncLang,
574
563
  onSpeechEnd: () => {
575
- // Add a small delay after speech ends for natural flow
576
- setTimeout(() => {
577
- if (nextQuestionRef.current) {
578
- nextQuestionRef.current();
579
- }
580
- }, 50);
564
+ // Immediately move to next question with no delay
565
+ if (nextQuestionRef.current) {
566
+ nextQuestionRef.current();
567
+ }
581
568
  }
582
569
  });
583
570
  } else {
@@ -600,12 +587,10 @@ const CurriculumLearning = forwardRef(({
600
587
  avatarRef.current.speakText(failureMessage, {
601
588
  lipsyncLang: config.lipsyncLang,
602
589
  onSpeechEnd: () => {
603
- // Add a small delay after speech ends for natural flow
604
- setTimeout(() => {
605
- if (nextQuestionRef.current) {
606
- nextQuestionRef.current();
607
- }
608
- }, 50);
590
+ // Immediately move to next question with no delay
591
+ if (nextQuestionRef.current) {
592
+ nextQuestionRef.current();
593
+ }
609
594
  }
610
595
  });
611
596
  }
@@ -681,11 +666,12 @@ const CurriculumLearning = forwardRef(({
681
666
  // Check if there's teaching content (either avatar_script or body)
682
667
  const hasTeachingContent = currentLesson?.avatar_script || currentLesson?.body;
683
668
  if (autoStart && hasTeachingContent) {
669
+ // Immediate start with minimal delay for initialization
684
670
  setTimeout(() => {
685
671
  if (startTeachingRef.current) {
686
672
  startTeachingRef.current();
687
673
  }
688
- }, 200);
674
+ }, 50);
689
675
  }
690
676
  }, [autoStart, getCurrentLesson]);
691
677
 
@@ -168,9 +168,9 @@ class TalkingHead {
168
168
  cameraPanEnable: false,
169
169
  cameraZoomEnable: false,
170
170
  lightAmbientColor: 0xffffff,
171
- lightAmbientIntensity: 1.2,
171
+ lightAmbientIntensity: 2,
172
172
  lightDirectColor: 0x8888aa,
173
- lightDirectIntensity: 18,
173
+ lightDirectIntensity: 30,
174
174
  lightDirectPhi: 1,
175
175
  lightDirectTheta: 2,
176
176
  lightSpotIntensity: 0,