Spaces:
Sleeping
Sleeping
File size: 633 Bytes
c44ceec 0ba731e c44ceec 0ba731e c44ceec 120a806 0ba731e c44ceec | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | from fastapi import FastAPI
def add_ping_route(app: FastAPI, call_langflow):
"""
Adds a /ping route to the given FastAPI app.
Calls the provided call_langflow function with a test message to verify it's working.
"""
@app.get("/ping")
def ping():
"""Simple health check that also calls the chat function."""
try:
# Call the chat function with test message and empty history
result = call_langflow("What is your name?", [])
return {"status": "ok", "chat_result": result}
except Exception as e:
return {"status": "error", "detail": str(e)} |