Hassan Ali Khan commited on
Commit
71ee143
·
1 Parent(s): bdea1dc
Files changed (1) hide show
  1. src/study_chatbot/app.py +4 -0
src/study_chatbot/app.py CHANGED
@@ -14,6 +14,7 @@ from agents import Runner, Agent
14
  @cl.on_chat_start
15
  async def on_start():
16
  """Create and store the study agent in the user session when a chat starts."""
 
17
  agent = create_study_agent()
18
  cl.user_session.set("agent", agent)
19
  cl.user_session.set("chat_history", [])
@@ -25,6 +26,7 @@ async def main(message: cl.Message) -> None:
25
  """Process incoming messages with the triage agent instead of echoing."""
26
  # Extract text from message safely
27
  text = message.content
 
28
 
29
  if not text:
30
  await cl.Message(content="Please send a short text question or request.").send()
@@ -39,7 +41,9 @@ async def main(message: cl.Message) -> None:
39
  history.append({"role": "user", "content": text})
40
 
41
  try:
 
42
  result = await Runner.run(agent, history)
 
43
  response = result.final_output
44
 
45
  thinking.content = str(response)
 
14
  @cl.on_chat_start
15
  async def on_start():
16
  """Create and store the study agent in the user session when a chat starts."""
17
+ print("Chat Started")
18
  agent = create_study_agent()
19
  cl.user_session.set("agent", agent)
20
  cl.user_session.set("chat_history", [])
 
26
  """Process incoming messages with the triage agent instead of echoing."""
27
  # Extract text from message safely
28
  text = message.content
29
+ print("Received message:", text)
30
 
31
  if not text:
32
  await cl.Message(content="Please send a short text question or request.").send()
 
41
  history.append({"role": "user", "content": text})
42
 
43
  try:
44
+ print("Running agent with history:", history)
45
  result = await Runner.run(agent, history)
46
+ print("Agent result:", result)
47
  response = result.final_output
48
 
49
  thinking.content = str(response)