disclosure-bureau/web/app/graph/page.tsx
Luiz Gustavo eaf282c535
Some checks failed
CI / Web — typecheck + lint + build (push) Failing after 40s
CI / Scripts — Python smoke (push) Failing after 3s
CI / Web — npm audit (push) Failing after 29s
CI / Retrieval — golden set (Recall@5 + MRR) (push) Failing after 3s
W2: rerank opt-in, analyze_image_region tool, RAG eval, graph cleanup, ADRs
- TD#8 hybrid.ts: rerank_strategy {always|when_top_k_gt|never} + threshold
  (default skips rerank for top_k ≤ 15; chat tool uses threshold 10)
- O11 vision.ts + tools.ts: analyze_image_region tool — sharp-crops the
  bbox, claude CLI reads the temp PNG via Read tool, Sonnet vision answers
- TD#12 /graph: SigmaGraph replaces ForceGraphCanvas; react-force-graph-2d
  uninstalled (-37 transitive deps); force-graph-canvas.tsx deleted
- TD#27 messages/route.ts gatherContext slice sizes via CTX_* env vars
- TD#22 tests/rag/: golden.yaml (15 queries) + run.py (Recall@k + MRR +
  negative-pass rate) + baseline.json + CI job in .forgejo/workflows/ci.yml
- docs/adrs/: ADR-001..005 published from systems-atelier deliverables

Verified live on disclosure.top: top_k=5 path skips rerank (6.7s embed-only,
was 12-15s with rerank); rerank=always still available on demand.
First RAG baseline: Recall@5 = 0.2083, MRR = 0.25, Negative pass = 1.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 19:20:09 -03:00

55 lines
2.3 KiB
TypeScript

/**
* /graph — force-directed entity graph view, Obsidian-style, FULLSCREEN.
*
* Layout: fixed 100vh viewport, overlay HUD com header + AuthBar no canto,
* canvas full-bleed por baixo. Mais imersivo que o layout em container.
*/
import Link from "next/link";
import { AuthBar } from "@/components/auth-bar";
// W2-TD#12: switched from react-force-graph-2d to @react-sigma. One graph
// library is enough; sigma is the one already used by the entity sidebar.
import { SigmaGraph } from "@/components/sigma-graph";
export const dynamic = "force-dynamic";
export default function GraphPage() {
return (
<main className="fixed inset-0 bg-[#040810] overflow-hidden">
{/* Top overlay HUD */}
<div className="absolute top-0 left-0 right-0 z-30 pointer-events-none">
<div className="flex items-start justify-between gap-4 p-4 bg-gradient-to-b from-[#040810]/95 via-[#040810]/60 to-transparent pointer-events-auto">
<div>
<div className="font-mono text-[10px] text-[#5a6678] tracking-widest uppercase mb-1">
graph · entity co-mention network
</div>
<h1 className="font-mono text-xl text-[#00ff9c]"> Bureau Connections</h1>
</div>
<div className="flex items-center gap-2 pointer-events-auto">
<Link
href="/"
className="font-mono text-xs px-3 py-1.5 border border-[#7fdbff] text-[#7fdbff] hover:bg-[rgba(127,219,255,0.10)] rounded"
>
home
</Link>
<AuthBar />
</div>
</div>
</div>
{/* Bottom legend */}
<div className="absolute bottom-0 left-0 right-0 z-30 pointer-events-none">
<div className="bg-gradient-to-t from-[#040810]/95 via-[#040810]/60 to-transparent p-3">
<p className="font-mono text-[10px] text-[#5a6678] text-center max-w-3xl mx-auto">
Cada é uma entidade. Arestas = co-menções no mesmo chunk (peso = de chunks compartilhados).
Clique para expandir vizinhos + abrir a página da entidade. Dados de <code className="text-[#7fdbff]">public.entity_mentions</code>.
</p>
</div>
</div>
{/* Fullscreen canvas */}
<div className="absolute inset-0">
<SigmaGraph />
</div>
</main>
);
}