Spaces:
Sleeping
Sleeping
Update ping.py
Browse files
ping.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
|
| 3 |
-
def add_ping_route(app: FastAPI,
|
| 4 |
"""
|
| 5 |
Adds a /ping route to the given FastAPI app.
|
| 6 |
-
Calls the provided
|
| 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 =
|
| 14 |
return {"status": "ok", "chat_result": result}
|
| 15 |
except Exception as e:
|
| 16 |
return {"status": "error", "detail": str(e)}
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
|
| 3 |
+
def add_ping_route(app: FastAPI, call_langflow):
|
| 4 |
"""
|
| 5 |
Adds a /ping route to the given FastAPI app.
|
| 6 |
+
Calls the provided call_langflow 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 = call_langflow("What is your name?", [])
|
| 14 |
return {"status": "ok", "chat_result": result}
|
| 15 |
except Exception as e:
|
| 16 |
return {"status": "error", "detail": str(e)}
|