Spaces:
Sleeping
Sleeping
| 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. | |
| """ | |
| 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)} |