Add advisor UI with restored vs tokenized split view (the money shot)
This commit is contained in:
74
ui/index.html
Normal file
74
ui/index.html
Normal file
@@ -0,0 +1,74 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>HNCB · Advisor Assistant (de-identification demo)</title>
|
||||
<style>
|
||||
:root { font-family: system-ui, -apple-system, "Noto Sans TC", sans-serif; }
|
||||
body { margin: 0; background: #0f172a; color: #e2e8f0; }
|
||||
.wrap { max-width: 820px; margin: 40px auto; padding: 0 20px; }
|
||||
h1 { font-size: 20px; font-weight: 650; }
|
||||
.sub { color: #94a3b8; font-size: 13px; margin-top: -6px; }
|
||||
textarea { width: 100%; box-sizing: border-box; min-height: 78px; padding: 12px;
|
||||
border-radius: 10px; border: 1px solid #334155; background: #1e293b; color: #e2e8f0; font-size: 14px; }
|
||||
button { margin-top: 12px; padding: 10px 18px; border: 0; border-radius: 10px;
|
||||
background: #2563eb; color: white; font-weight: 600; cursor: pointer; }
|
||||
button:disabled { opacity: .5; cursor: default; }
|
||||
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
|
||||
.card { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 14px; }
|
||||
.card h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 8px; color: #94a3b8; }
|
||||
.restored { border-color: #16a34a; }
|
||||
.cloud { border-color: #d97706; }
|
||||
pre { white-space: pre-wrap; word-break: break-word; font-size: 13px; margin: 0; }
|
||||
.tag { font-size: 11px; color: #f59e0b; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
<h1>HNCB · Advisor Assistant</h1>
|
||||
<p class="sub">Reversible PII de-identification through Amplify AI Gateway (Fusion). Everything the cloud sees is tokenized.</p>
|
||||
|
||||
<textarea id="q">請幫我整理王小明最近三個月的理財往來,並給我下次拜訪話術。</textarea><br />
|
||||
<button id="go" onclick="run()">Send to gateway</button>
|
||||
|
||||
<div class="grid">
|
||||
<div class="card restored">
|
||||
<h2>Advisor sees (identity restored on-prem)</h2>
|
||||
<pre id="final">—</pre>
|
||||
</div>
|
||||
<div class="card cloud">
|
||||
<h2>What the cloud actually saw <span class="tag">tokenized</span></h2>
|
||||
<pre id="deid">—</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// TODO: point this at your Fusion gateway endpoint after deploy.
|
||||
const GATEWAY_URL = "http://REPLACE_ME_FUSION_HOST:8080/advisor";
|
||||
|
||||
async function run() {
|
||||
const btn = document.getElementById("go");
|
||||
btn.disabled = true;
|
||||
document.getElementById("final").textContent = "…thinking…";
|
||||
document.getElementById("deid").textContent = "…";
|
||||
try {
|
||||
const res = await fetch(GATEWAY_URL, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ query: document.getElementById("q").value }),
|
||||
});
|
||||
const data = await res.json();
|
||||
// Fusion is expected to return { final, deidentified_prompt }.
|
||||
document.getElementById("final").textContent = data.final || JSON.stringify(data, null, 2);
|
||||
document.getElementById("deid").textContent = data.deidentified_prompt || "(gateway did not echo the de-identified prompt)";
|
||||
} catch (e) {
|
||||
document.getElementById("final").textContent = "Error: " + e.message;
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user