Mephesto1 commited on
Commit
01cc141
·
verified ·
1 Parent(s): 3f14c50

Upload chat_agent.py

Browse files
Files changed (1) hide show
  1. agents/chat_agent.py +21 -4
agents/chat_agent.py CHANGED
@@ -8,18 +8,35 @@ class ChatAgent:
8
  self.chat_history = []
9
 
10
  def respond_to_query(self, message: str) -> str:
11
- # Replace this with your actual logic or import from another agent
12
- if "next pod" in message.lower():
 
13
  return "Your next pod site is right_leg."
14
- elif "sensor" in message.lower():
15
  return "Your next sensor site is left_arm."
16
- elif "i used" in message.lower():
17
  site = message.split("i used")[1].strip().replace(".", "")
18
  self.chat_history.append((message, f"Logged {site} as your most recent site."))
19
  return f"Thanks, I’ve logged {site} as your most recent pod site."
 
 
20
  else:
21
  return "Try asking about your next pod or sensor site."
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  def handle_message(self, user_message):
24
  response = self.respond_to_query(user_message)
25
  self.chat_history.append((user_message, response))
 
8
  self.chat_history = []
9
 
10
  def respond_to_query(self, message: str) -> str:
11
+ message = message.lower()
12
+
13
+ if "next pod" in message:
14
  return "Your next pod site is right_leg."
15
+ elif "sensor" in message:
16
  return "Your next sensor site is left_arm."
17
+ elif "i used" in message:
18
  site = message.split("i used")[1].strip().replace(".", "")
19
  self.chat_history.append((message, f"Logged {site} as your most recent site."))
20
  return f"Thanks, I’ve logged {site} as your most recent pod site."
21
+ elif "schedule" in message or "show me" in message:
22
+ return self.get_schedule()
23
  else:
24
  return "Try asking about your next pod or sensor site."
25
 
26
+ def get_schedule(self) -> str:
27
+ # Replace with dynamic logic or dataset later
28
+ schedule = [
29
+ "08/24/2025 — Sensor (left_arm)",
30
+ "08/24/2025 — Pod (left_arm)",
31
+ "08/27/2025 — Pod (left_leg)",
32
+ "08/30/2025 — Pod (left_stomach)",
33
+ "09/02/2025 — Sensor (right_leg)",
34
+ "09/02/2025 — Pod (right_arm)",
35
+ "09/05/2025 — Pod (right_leg)",
36
+ "09/08/2025 — Pod (right_stomach)",
37
+ ]
38
+ return "📅 Upcoming Schedule:\n" + "\n".join(schedule)
39
+
40
  def handle_message(self, user_message):
41
  response = self.respond_to_query(user_message)
42
  self.chat_history.append((user_message, response))