TeleologyHI commited on
Commit
f898d34
·
1 Parent(s): 2e4c7ad
src/core/consciousness_kernel.py CHANGED
@@ -10,6 +10,7 @@ from .awareness_engine import AwarenessEngine
10
  from .integration_manager import IntegrationManager, AwarenessState, IntegratedState, AwarenessLevel
11
  from .dynamic_self_model import DynamicSelfModel
12
  from .experience_simulator import ExperienceSimulator
 
13
 
14
  # Add imports for classes used in the updated implementation
15
  class PhiPrimeCalculator:
@@ -97,9 +98,15 @@ class ConsciousnessKernel:
97
  A dictionary containing the processed conscious output
98
  """
99
  awareness = await self.awareness_engine.process(input_state)
 
100
  # Convert awareness to a Dict[str, Any] before passing to integrate
101
  awareness_dict = awareness if isinstance(awareness, dict) else awareness.__dict__
102
- integrated_state = await self.integration_manager.integrate(awareness_dict)
 
 
 
 
 
103
 
104
  # Convert integrated_state to Dict[str, Any] before passing to update
105
  integrated_dict = integrated_state if isinstance(integrated_state, dict) else integrated_state.__dict__
@@ -116,6 +123,7 @@ class ConsciousnessKernel:
116
  self.state_history.append(integrated_state)
117
 
118
  return await self._generate_conscious_output(experience)
 
119
  def _initialize_consciousness_state(self) -> ConsciousnessState:
120
  """
121
  Initialize a default consciousness state with zero values.
 
10
  from .integration_manager import IntegrationManager, AwarenessState, IntegratedState, AwarenessLevel
11
  from .dynamic_self_model import DynamicSelfModel
12
  from .experience_simulator import ExperienceSimulator
13
+ from .fix_integration import create_awareness_state_from_dict
14
 
15
  # Add imports for classes used in the updated implementation
16
  class PhiPrimeCalculator:
 
98
  A dictionary containing the processed conscious output
99
  """
100
  awareness = await self.awareness_engine.process(input_state)
101
+
102
  # Convert awareness to a Dict[str, Any] before passing to integrate
103
  awareness_dict = awareness if isinstance(awareness, dict) else awareness.__dict__
104
+
105
+ # Create an AwarenessState object from the dictionary
106
+ awareness_state = create_awareness_state_from_dict(awareness_dict)
107
+
108
+ # Now pass the AwarenessState object to the integrate method
109
+ integrated_state = await self.integration_manager.integrate(awareness_state)
110
 
111
  # Convert integrated_state to Dict[str, Any] before passing to update
112
  integrated_dict = integrated_state if isinstance(integrated_state, dict) else integrated_state.__dict__
 
123
  self.state_history.append(integrated_state)
124
 
125
  return await self._generate_conscious_output(experience)
126
+
127
  def _initialize_consciousness_state(self) -> ConsciousnessState:
128
  """
129
  Initialize a default consciousness state with zero values.
src/core/fix_integration.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Dict, Any
2
+ from .integration_manager import AwarenessState, AwarenessLevel
3
+
4
+ def create_awareness_state_from_dict(awareness_dict: Dict[str, Any]) -> AwarenessState:
5
+ """
6
+ Create an AwarenessState object from a dictionary.
7
+
8
+ Args:
9
+ awareness_dict: Dictionary containing awareness state attributes
10
+
11
+ Returns:
12
+ AwarenessState object
13
+ """
14
+ # Extract required fields with defaults
15
+ level_value = awareness_dict.get('level', AwarenessLevel.BASIC)
16
+ # If level is already an enum value, use it; otherwise convert from dict or use default
17
+ if not isinstance(level_value, AwarenessLevel):
18
+ if isinstance(level_value, dict) and 'name' in level_value:
19
+ level_name = level_value['name']
20
+ try:
21
+ level_value = AwarenessLevel[level_name]
22
+ except (KeyError, TypeError):
23
+ level_value = AwarenessLevel.BASIC
24
+ else:
25
+ level_value = AwarenessLevel.BASIC
26
+
27
+ # Create the AwarenessState object
28
+ return AwarenessState(
29
+ level=level_value,
30
+ perception_data=awareness_dict.get('perception_data', {}),
31
+ cognition_state=awareness_dict.get('cognitive_state', {}),
32
+ emotional_valence=awareness_dict.get('emotional_valence', 0.0),
33
+ semantic_context=awareness_dict.get('semantic_context'),
34
+ temporal_awareness=awareness_dict.get('temporal_awareness')
35
+ )