dyadd commited on
Commit
f06968e
·
verified ·
1 Parent(s): e398740

Upload folder using huggingface_hub

Browse files
nbs/02_learning_interface.ipynb CHANGED
@@ -552,8 +552,15 @@
552
  " # Would integrate with speech-to-text here\n",
553
  " return \"Audio transcription would appear here\"\n",
554
  " \n",
555
- " async def generate_goals(state):\n",
556
- " \"\"\"Generate new goal suggestions.\"\"\"\n",
 
 
 
 
 
 
 
557
  " rotation = self.tutor.learning_context.rotation\n",
558
  " if rotation.specialty and rotation.setting:\n",
559
  " goals = await self.tutor.generate_smart_goals(\n",
@@ -562,12 +569,20 @@
562
  " )\n",
563
  " state[\"suggested_goals\"] = goals\n",
564
  " return self._update_displays(state)\n",
565
- " return []\n",
566
  " \n",
567
- " async def add_user_goal(text, state):\n",
568
- " \"\"\"Add user-specified goal.\"\"\"\n",
 
 
 
 
 
 
 
 
569
  " if not text.strip():\n",
570
- " return state\n",
571
  " \n",
572
  " rotation = self.tutor.learning_context.rotation\n",
573
  " if rotation.specialty and rotation.setting:\n",
@@ -579,21 +594,42 @@
579
  " if goal:\n",
580
  " state[\"suggested_goals\"].append(goal)\n",
581
  " return self._update_displays(state)\n",
582
- " return state\n",
583
  " \n",
584
- " def select_goal(evt: gr.SelectData, state):\n",
585
- " \"\"\"Set selected goal as active.\"\"\"\n",
 
 
 
 
 
 
 
 
586
  " if evt.index[0] < len(state[\"suggested_goals\"]):\n",
587
  " goal = state[\"suggested_goals\"][evt.index[0]]\n",
588
  " self.tutor.learning_context.add_smart_goal(goal)\n",
589
  " return self._update_displays(state)\n",
590
- " return state\n",
591
- " \n",
592
- " def end_discussion(state):\n",
593
- " \"\"\"End current discussion.\"\"\"\n",
594
- " self.tutor.end_discussion()\n",
595
  " return self._update_displays(state)\n",
596
  " \n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  " def clear_discussion():\n",
598
  " \"\"\"Clear discussion history.\"\"\"\n",
599
  " self.tutor.clear_discussion()\n",
 
552
  " # Would integrate with speech-to-text here\n",
553
  " return \"Audio transcription would appear here\"\n",
554
  " \n",
555
+ " async def generate_goals(self, state: Dict[str, Any]) -> List:\n",
556
+ " \"\"\"Generate new goal suggestions.\n",
557
+ " \n",
558
+ " Args:\n",
559
+ " state: Interface state\n",
560
+ " \n",
561
+ " Returns:\n",
562
+ " list: Updated display data\n",
563
+ " \"\"\"\n",
564
  " rotation = self.tutor.learning_context.rotation\n",
565
  " if rotation.specialty and rotation.setting:\n",
566
  " goals = await self.tutor.generate_smart_goals(\n",
 
569
  " )\n",
570
  " state[\"suggested_goals\"] = goals\n",
571
  " return self._update_displays(state)\n",
572
+ " return [[], [], [], \"No active learning goal\"]\n",
573
  " \n",
574
+ " async def add_user_goal(self, text: str, state: Dict[str, Any]) -> List:\n",
575
+ " \"\"\"Add user-specified goal.\n",
576
+ " \n",
577
+ " Args:\n",
578
+ " text: User's goal text\n",
579
+ " state: Interface state\n",
580
+ " \n",
581
+ " Returns:\n",
582
+ " list: Updated display data\n",
583
+ " \"\"\"\n",
584
  " if not text.strip():\n",
585
+ " return self._update_displays(state)\n",
586
  " \n",
587
  " rotation = self.tutor.learning_context.rotation\n",
588
  " if rotation.specialty and rotation.setting:\n",
 
594
  " if goal:\n",
595
  " state[\"suggested_goals\"].append(goal)\n",
596
  " return self._update_displays(state)\n",
597
+ " return self._update_displays(state)\n",
598
  " \n",
599
+ " def select_goal(self, evt: gr.SelectData, state: Dict[str, Any]) -> List:\n",
600
+ " \"\"\"Set selected goal as active.\n",
601
+ " \n",
602
+ " Args:\n",
603
+ " evt: Selection event data\n",
604
+ " state: Interface state\n",
605
+ " \n",
606
+ " Returns:\n",
607
+ " list: Updated display data\n",
608
+ " \"\"\"\n",
609
  " if evt.index[0] < len(state[\"suggested_goals\"]):\n",
610
  " goal = state[\"suggested_goals\"][evt.index[0]]\n",
611
  " self.tutor.learning_context.add_smart_goal(goal)\n",
612
  " return self._update_displays(state)\n",
 
 
 
 
 
613
  " return self._update_displays(state)\n",
614
  " \n",
615
+ " def end_discussion(self, state: Dict[str, Any]) -> List:\n",
616
+ " \"\"\"End current discussion.\n",
617
+ " \n",
618
+ " Args:\n",
619
+ " state: Interface state\n",
620
+ " \n",
621
+ " Returns:\n",
622
+ " list: Updated display data\n",
623
+ " \"\"\"\n",
624
+ " if self.tutor.learning_context.active_goal:\n",
625
+ " self.tutor.learning_context.complete_active_goal()\n",
626
+ " \n",
627
+ " self.tutor.end_discussion()\n",
628
+ " state[\"discussion_active\"] = False\n",
629
+ " state[\"discussion_start\"] = None\n",
630
+ " \n",
631
+ " return self._update_displays(state) \n",
632
+ " \n",
633
  " def clear_discussion():\n",
634
  " \"\"\"Clear discussion history.\"\"\"\n",
635
  " self.tutor.clear_discussion()\n",
wardbuddy/learning_interface.py CHANGED
@@ -463,8 +463,15 @@ class LearningInterface:
463
  # Would integrate with speech-to-text here
464
  return "Audio transcription would appear here"
465
 
466
- async def generate_goals(state):
467
- """Generate new goal suggestions."""
 
 
 
 
 
 
 
468
  rotation = self.tutor.learning_context.rotation
469
  if rotation.specialty and rotation.setting:
470
  goals = await self.tutor.generate_smart_goals(
@@ -473,12 +480,20 @@ class LearningInterface:
473
  )
474
  state["suggested_goals"] = goals
475
  return self._update_displays(state)
476
- return []
477
 
478
- async def add_user_goal(text, state):
479
- """Add user-specified goal."""
 
 
 
 
 
 
 
 
480
  if not text.strip():
481
- return state
482
 
483
  rotation = self.tutor.learning_context.rotation
484
  if rotation.specialty and rotation.setting:
@@ -490,21 +505,42 @@ class LearningInterface:
490
  if goal:
491
  state["suggested_goals"].append(goal)
492
  return self._update_displays(state)
493
- return state
494
 
495
- def select_goal(evt: gr.SelectData, state):
496
- """Set selected goal as active."""
 
 
 
 
 
 
 
 
497
  if evt.index[0] < len(state["suggested_goals"]):
498
  goal = state["suggested_goals"][evt.index[0]]
499
  self.tutor.learning_context.add_smart_goal(goal)
500
  return self._update_displays(state)
501
- return state
502
-
503
- def end_discussion(state):
504
- """End current discussion."""
505
- self.tutor.end_discussion()
506
  return self._update_displays(state)
507
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
  def clear_discussion():
509
  """Clear discussion history."""
510
  self.tutor.clear_discussion()
 
463
  # Would integrate with speech-to-text here
464
  return "Audio transcription would appear here"
465
 
466
+ async def generate_goals(self, state: Dict[str, Any]) -> List:
467
+ """Generate new goal suggestions.
468
+
469
+ Args:
470
+ state: Interface state
471
+
472
+ Returns:
473
+ list: Updated display data
474
+ """
475
  rotation = self.tutor.learning_context.rotation
476
  if rotation.specialty and rotation.setting:
477
  goals = await self.tutor.generate_smart_goals(
 
480
  )
481
  state["suggested_goals"] = goals
482
  return self._update_displays(state)
483
+ return [[], [], [], "No active learning goal"]
484
 
485
+ async def add_user_goal(self, text: str, state: Dict[str, Any]) -> List:
486
+ """Add user-specified goal.
487
+
488
+ Args:
489
+ text: User's goal text
490
+ state: Interface state
491
+
492
+ Returns:
493
+ list: Updated display data
494
+ """
495
  if not text.strip():
496
+ return self._update_displays(state)
497
 
498
  rotation = self.tutor.learning_context.rotation
499
  if rotation.specialty and rotation.setting:
 
505
  if goal:
506
  state["suggested_goals"].append(goal)
507
  return self._update_displays(state)
508
+ return self._update_displays(state)
509
 
510
+ def select_goal(self, evt: gr.SelectData, state: Dict[str, Any]) -> List:
511
+ """Set selected goal as active.
512
+
513
+ Args:
514
+ evt: Selection event data
515
+ state: Interface state
516
+
517
+ Returns:
518
+ list: Updated display data
519
+ """
520
  if evt.index[0] < len(state["suggested_goals"]):
521
  goal = state["suggested_goals"][evt.index[0]]
522
  self.tutor.learning_context.add_smart_goal(goal)
523
  return self._update_displays(state)
 
 
 
 
 
524
  return self._update_displays(state)
525
 
526
+ def end_discussion(self, state: Dict[str, Any]) -> List:
527
+ """End current discussion.
528
+
529
+ Args:
530
+ state: Interface state
531
+
532
+ Returns:
533
+ list: Updated display data
534
+ """
535
+ if self.tutor.learning_context.active_goal:
536
+ self.tutor.learning_context.complete_active_goal()
537
+
538
+ self.tutor.end_discussion()
539
+ state["discussion_active"] = False
540
+ state["discussion_start"] = None
541
+
542
+ return self._update_displays(state)
543
+
544
  def clear_discussion():
545
  """Clear discussion history."""
546
  self.tutor.clear_discussion()