LogicDataSolutions commited on
Commit
120a806
·
verified ·
1 Parent(s): c44ceec

Update ping.py

Browse files
Files changed (1) hide show
  1. ping.py +3 -2
ping.py CHANGED
@@ -3,13 +3,14 @@ from fastapi import FastAPI
3
  def add_ping_route(app: FastAPI, chat_function):
4
  """
5
  Adds a /ping route to the given FastAPI app.
6
- Calls the provided chat_function to verify it's working.
7
  """
8
  @app.get("/ping")
9
  def ping():
10
  """Simple health check that also calls the chat function."""
11
  try:
12
- result = chat_function()
 
13
  return {"status": "ok", "chat_result": result}
14
  except Exception as e:
15
  return {"status": "error", "detail": str(e)}
 
3
  def add_ping_route(app: FastAPI, chat_function):
4
  """
5
  Adds a /ping route to the given FastAPI app.
6
+ Calls the provided chat_function with a test message to verify it's working.
7
  """
8
  @app.get("/ping")
9
  def ping():
10
  """Simple health check that also calls the chat function."""
11
  try:
12
+ # Call the chat function with test message and empty history
13
+ result = chat_function("What is your name?", [])
14
  return {"status": "ok", "chat_result": result}
15
  except Exception as e:
16
  return {"status": "error", "detail": str(e)}