AIDA / RUN_TEST_UI.md
destinyebuka's picture
fyp
8c9362b

A newer version of the Gradio SDK is available: 6.9.0

Upgrade

Run Test UI - QUICK START

The Problem

Opening test_chat_ui.html directly (file://) causes CORS errors because browsers send origin: null.

The Solution - Serve it via HTTP

Option 1: Using Python (Recommended)

In a NEW terminal (keep the backend server running in the first one):

cd C:\Users\Destiny Ebuka\Desktop\python-Backend\lojiz-backend\AIDA
python -m http.server 8080

Then open in browser: http://localhost:8080/test_chat_ui.html

Option 2: Using VS Code Live Server

  1. Install "Live Server" extension in VS Code
  2. Right-click test_chat_ui.html
  3. Select "Open with Live Server"

Full Testing Steps

Terminal 1 - Backend Server

cd C:\Users\Destiny Ebuka\Desktop\python-Backend\lojiz-backend\AIDA
python -m uvicorn main:app --reload

Terminal 2 - Test UI Server

cd C:\Users\Destiny Ebuka\Desktop\python-Backend\lojiz-backend\AIDA
python -m http.server 8080

Browser

Open: http://localhost:8080/test_chat_ui.html

✅ Now CORS will work because:

  • UI runs on http://localhost:8080
  • API runs on http://localhost:8000
  • Both are proper HTTP origins (not null)
  • CORS middleware allows localhost

Test the Login

  1. Enter credentials
  2. Click "Login"
  3. Check Debug Output - should see successful response with JWT
  4. Check server logs - should see:
    INFO: OPTIONS /api/auth/login HTTP/1.1" 200 OK
    INFO: POST /api/auth/login HTTP/1.1" 200 OK
    

That's it! 🚀