Spaces:
Running
Running
Update app/app.py
Browse files- app/app.py +9 -5
app/app.py
CHANGED
|
@@ -79,11 +79,15 @@ async def health_check():
|
|
| 79 |
|
| 80 |
@app.route("/api", methods=["POST"])
|
| 81 |
async def api_endpoint():
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
|
| 89 |
@app.route("/crypto", methods=["POST"])
|
|
|
|
| 79 |
|
| 80 |
@app.route("/api", methods=["POST"])
|
| 81 |
async def api_endpoint():
|
| 82 |
+
try:
|
| 83 |
+
data = await request.get_json()
|
| 84 |
+
tool_name = data.get("tool")
|
| 85 |
+
params = data.get("params", {})
|
| 86 |
+
result = await tools.run(tool_name, **params)
|
| 87 |
+
return jsonify({"result": result})
|
| 88 |
+
except Exception as e:
|
| 89 |
+
logger.error(f"API error: {e}")
|
| 90 |
+
return jsonify({"error": str(e)}), 500
|
| 91 |
|
| 92 |
|
| 93 |
@app.route("/crypto", methods=["POST"])
|