anderson-ufrj commited on
Commit
7a47fb6
·
2 Parent(s): e91e60f 1955e9b

merge: resolve conflict between main and hf-fastapi branches

Browse files
Makefile CHANGED
@@ -4,7 +4,7 @@
4
  .DEFAULT_GOAL := help
5
 
6
  # Variables
7
- PYTHON := python3.11
8
  PIP := $(PYTHON) -m pip
9
  PYTEST := $(PYTHON) -m pytest
10
  BLACK := $(PYTHON) -m black
 
4
  .DEFAULT_GOAL := help
5
 
6
  # Variables
7
+ PYTHON := python3
8
  PIP := $(PYTHON) -m pip
9
  PYTEST := $(PYTHON) -m pytest
10
  BLACK := $(PYTHON) -m black
src/api/routes/chat.py CHANGED
@@ -31,6 +31,8 @@ router = APIRouter(tags=["chat"])
31
  intent_detector = IntentDetector()
32
 
33
  # Drummond agent handled by factory to avoid import issues
 
 
34
 
35
  class ChatRequest(BaseModel):
36
  """Chat message request"""
 
31
  intent_detector = IntentDetector()
32
 
33
  # Drummond agent handled by factory to avoid import issues
34
+ # Initialize master agent
35
+ master_agent = MasterAgent()
36
 
37
  class ChatRequest(BaseModel):
38
  """Chat message request"""
src/services/chat_service.py CHANGED
@@ -366,8 +366,8 @@ class ChatService:
366
  self.sessions: Dict[str, ChatSession] = {}
367
  self.messages: Dict[str, List[Dict]] = defaultdict(list)
368
 
369
- # Agents will be initialized lazily when needed
370
- self.agents = {}
371
 
372
  async def get_or_create_session(
373
  self,
@@ -444,4 +444,27 @@ class ChatService:
444
  """Update session with current investigation"""
445
  if session_id in self.sessions:
446
  self.sessions[session_id].current_investigation_id = investigation_id
447
- self.sessions[session_id].last_activity = datetime.utcnow()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  self.sessions: Dict[str, ChatSession] = {}
367
  self.messages: Dict[str, List[Dict]] = defaultdict(list)
368
 
369
+ # Initialize agents
370
+ self._initialize_agents()
371
 
372
  async def get_or_create_session(
373
  self,
 
444
  """Update session with current investigation"""
445
  if session_id in self.sessions:
446
  self.sessions[session_id].current_investigation_id = investigation_id
447
+ self.sessions[session_id].last_activity = datetime.utcnow()
448
+
449
+ def _initialize_agents(self):
450
+ """Initialize available agents"""
451
+ # Import here to avoid circular imports
452
+ from src.agents import (
453
+ MasterAgent, InvestigatorAgent, AnalystAgent,
454
+ ReporterAgent, CommunicationAgent
455
+ )
456
+
457
+ # Create agent instances
458
+ agents = {
459
+ "abaporu": MasterAgent(),
460
+ "zumbi": InvestigatorAgent(),
461
+ "anita": AnalystAgent(),
462
+ "tiradentes": ReporterAgent(),
463
+ "drummond": CommunicationAgent()
464
+ }
465
+
466
+ # Add agent_id attribute to each agent
467
+ for agent_id, agent in agents.items():
468
+ agent.agent_id = agent_id
469
+
470
+ self.agents = agents