Spaces:
Sleeping
Sleeping
Fist commit
Browse files- .dockerignore +18 -0
- app/services/validator_service.py +8 -5
.dockerignore
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# .dockerignore
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.pyc
|
| 4 |
+
*.pyo
|
| 5 |
+
*.pyd
|
| 6 |
+
.Python
|
| 7 |
+
env/
|
| 8 |
+
.venv/
|
| 9 |
+
venv/
|
| 10 |
+
|
| 11 |
+
.git/
|
| 12 |
+
.github/
|
| 13 |
+
.idea/
|
| 14 |
+
.vscode/
|
| 15 |
+
|
| 16 |
+
backup/
|
| 17 |
+
*.md
|
| 18 |
+
Makefile
|
app/services/validator_service.py
CHANGED
|
@@ -140,15 +140,18 @@ def get_card_resolver(client: httpx.AsyncClient, agent_card_url: str) -> Any:
|
|
| 140 |
# ==============================================================================
|
| 141 |
# FastAPI Routes
|
| 142 |
# ==============================================================================
|
| 143 |
-
|
|
|
|
|
|
|
|
|
|
| 144 |
async def validator_ui(request: Request) -> HTMLResponse:
|
| 145 |
-
|
| 146 |
-
|
|
|
|
| 147 |
try:
|
| 148 |
return templates.TemplateResponse(name, {"request": request})
|
| 149 |
except TemplateNotFound:
|
| 150 |
continue
|
| 151 |
-
# If neither exists, return a minimal message
|
| 152 |
return HTMLResponse("<h3>Validator UI template not found.</h3>", status_code=500)
|
| 153 |
|
| 154 |
|
|
@@ -355,4 +358,4 @@ async def handle_send_message(sid: str, json_data: dict[str, Any]) -> None: # t
|
|
| 355 |
except Exception as e:
|
| 356 |
await sio.emit("agent_response", {"error": f"Failed to send message: {e}", "id": message_id}, to=sid)
|
| 357 |
|
| 358 |
-
__all__ = ["router", "socketio_app", "HAS_SOCKETIO"]
|
|
|
|
| 140 |
# ==============================================================================
|
| 141 |
# FastAPI Routes
|
| 142 |
# ==============================================================================
|
| 143 |
+
|
| 144 |
+
# FIX: Add a decorator to handle requests without a trailing slash
|
| 145 |
+
@router.get("", response_class=HTMLResponse, include_in_schema=False) # Handles /validator
|
| 146 |
+
@router.get("/", response_class=HTMLResponse) # Handles /validator/
|
| 147 |
async def validator_ui(request: Request) -> HTMLResponse:
|
| 148 |
+
"""Serves the main validator UI page."""
|
| 149 |
+
# This logic already correctly tries to find validator.html or a fallback
|
| 150 |
+
for name in ("validator.html", "validator.hml"):
|
| 151 |
try:
|
| 152 |
return templates.TemplateResponse(name, {"request": request})
|
| 153 |
except TemplateNotFound:
|
| 154 |
continue
|
|
|
|
| 155 |
return HTMLResponse("<h3>Validator UI template not found.</h3>", status_code=500)
|
| 156 |
|
| 157 |
|
|
|
|
| 358 |
except Exception as e:
|
| 359 |
await sio.emit("agent_response", {"error": f"Failed to send message: {e}", "id": message_id}, to=sid)
|
| 360 |
|
| 361 |
+
__all__ = ["router", "socketio_app", "HAS_SOCKETIO"]
|