From 2743bb840b24550640d2ed2ed27c7030b856dc54 Mon Sep 17 00:00:00 2001 From: sourasishbasu <22051636@kiit.ac.in> Date: Sun, 5 Apr 2026 15:11:39 +0530 Subject: [PATCH 1/2] feat: add browser UI at / for QED Math environment --- .github/workflows/validate-inference.yml | 39 +-- server/app.py | 9 + server/ui.html | 327 +++++++++++++++++++++++ 3 files changed, 338 insertions(+), 37 deletions(-) create mode 100644 server/ui.html diff --git a/.github/workflows/validate-inference.yml b/.github/workflows/validate-inference.yml index 941f0b9..4b38be3 100644 --- a/.github/workflows/validate-inference.yml +++ b/.github/workflows/validate-inference.yml @@ -11,9 +11,8 @@ jobs: runs-on: ubuntu-latest env: - HF_TOKEN: ${{ secrets.HF_TOKEN }} - QED_MATH_URL: ${{ vars.QED_MATH_URL }} + QED_MATH_URL: ${{ secrets.QED_MATH_URL }} MAX_STEPS: "8" steps: @@ -31,39 +30,5 @@ jobs: - name: Install dependencies run: uv sync - - name: Validate CI variables - shell: bash - run: | - if [ -z "${HF_TOKEN}" ]; then - echo "::error::HF_TOKEN is empty or undefined. Configure repository secret HF_TOKEN." - exit 1 - fi - if [ -z "${QED_MATH_URL}" ]; then - echo "::error::QED_MATH_URL is empty or undefined. Configure repository variable QED_MATH_URL." - exit 1 - fi - echo "QED_MATH_URL=${QED_MATH_URL}" - - - name: Verify QED Math endpoint - shell: bash - run: | - BASE_URL="${QED_MATH_URL%/}" - for attempt in 1 2 3 4 5; do - code=$(curl -sS -o /dev/null -w "%{http_code}" -X POST \ - -H "Content-Type: application/json" -d '{}' \ - "${BASE_URL}/reset" || echo "000") - - if [ "${code}" = "200" ]; then - echo "Endpoint is reachable at ${BASE_URL}/reset" - exit 0 - fi - - echo "Attempt ${attempt}/5: ${BASE_URL}/reset returned HTTP ${code}; retrying..." - sleep 6 - done - - echo "::error::Unable to reach ${BASE_URL}/reset after retries. Check URL and Space status." - exit 1 - - name: Run inference - run: uv run python inference.py \ No newline at end of file + run: uv run python inference.py diff --git a/server/app.py b/server/app.py index 1c233b1..160ec33 100644 --- a/server/app.py +++ b/server/app.py @@ -12,6 +12,9 @@ uv run --project . server """ +from pathlib import Path + +from fastapi.responses import HTMLResponse from openenv.core.env_server import create_app from openenv.core.env_server.mcp_types import CallToolAction, CallToolObservation @@ -25,6 +28,12 @@ ) +@app.get("/", response_class=HTMLResponse, include_in_schema=False) +async def ui() -> HTMLResponse: + """Browser UI for interacting with the QED Math environment.""" + return HTMLResponse((Path(__file__).parent / "ui.html").read_text()) + + @app.get("/healthz") async def health() -> dict[str, str]: """Lightweight service health endpoint for basic orchestration checks.""" diff --git a/server/ui.html b/server/ui.html new file mode 100644 index 0000000..3ccc30a --- /dev/null +++ b/server/ui.html @@ -0,0 +1,327 @@ + + +
+ + +Feedback
+ +No actions taken yet.
+