WORKFLOW-APP/app/bizportal-2/page.tsx
Dave 7c3847fbb0 feat: BizPortal 2.0 — Python Playwright sidecar
Replaces the brittle agent-driven /api/bizportal/search queue with a
deterministic Python FastAPI service that drives BizPortal via a real
headless Chromium. The old flow is untouched.

What this adds:
- scripts/bizportal_service.py — FastAPI + Playwright service with
  /search, /reserve, /health endpoints. Persistent login session
  via storage_state.json. Locator-based selectors (vs eval JS).
- app/bizportal-2/ — new /bizportal-2 page, synchronous fetch
  (no polling), shows round-trip duration, mirrors the existing
  bulk-add + link UX.
- app/api/bizportal-2/{search,reserve,health}/route.ts — thin
  proxies to the Python sidecar.
- scripts/README.md, .env.example, .gitignore, requirements.txt.
- .gitignore: ignore tsconfig.tsbuildinfo (build artefact).

Wiring:
- components/NavBar.tsx: 'BizPortal 2.0' nav entry with TEST badge.
- app/bizportal/page.tsx: 'Try BizPortal 2.0' action link in
  header so the new option is discoverable from the existing page.

Run: cd scripts && source .venv/bin/activate && uvicorn
bizportal_service:app --port 7001
2026-08-17 18:33:36 +02:00

33 lines
1.1 KiB
TypeScript

// app/bizportal-2/page.tsx
// Server Component. Mirrors the existing /bizportal page but uses
// the Python Playwright service (scripts/bizportal_service.py) for
// synchronous search. The old queue-based flow is untouched.
import { Suspense } from "react";
import PageHeader from "@/components/PageHeader";
import BizPortal2Explorer from "./BizPortal2Explorer";
export const dynamic = "force-dynamic";
export default async function BizPortal2Page() {
return (
<>
<PageHeader
eyebrow="BizPortal 2.0"
title="CIPC Entity Search (Python sidecar)"
subtitle={
<>
<span>Direct Playwright service — no agent, no polling.</span>
<span>Calls the Python FastAPI sidecar on 127.0.0.1:7001.</span>
<span>Test version · old /bizportal page left untouched.</span>
</>
}
/>
<section className="container-x py-10">
<Suspense fallback={<div className="text-muted">Loading…</div>}>
<BizPortal2Explorer />
</Suspense>
</section>
</>
);
}