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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>ASA API Query Console</title>
|
| 7 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 8 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 9 |
+
<link href="https://fonts.googleapis.com/css2?family=Archivo+Narrow:wght@600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap" rel="stylesheet">
|
| 10 |
+
<style>
|
| 11 |
+
:root {
|
| 12 |
+
--bg-a: #f4efe4;
|
| 13 |
+
--bg-b: #d4e5ef;
|
| 14 |
+
--ink: #10222e;
|
| 15 |
+
--panel: rgba(255, 255, 255, 0.85);
|
| 16 |
+
--line: rgba(16, 34, 46, 0.18);
|
| 17 |
+
--accent: #0f6d85;
|
| 18 |
+
--accent-strong: #0a5062;
|
| 19 |
+
--ok: #1f7a3a;
|
| 20 |
+
--err: #9a1f3c;
|
| 21 |
+
--shadow: 0 18px 45px rgba(16, 34, 46, 0.14);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
* {
|
| 25 |
+
box-sizing: border-box;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
body {
|
| 29 |
+
margin: 0;
|
| 30 |
+
min-height: 100vh;
|
| 31 |
+
color: var(--ink);
|
| 32 |
+
background:
|
| 33 |
+
radial-gradient(circle at 85% 15%, rgba(15, 109, 133, 0.15) 0 18%, transparent 19%),
|
| 34 |
+
radial-gradient(circle at 12% 90%, rgba(239, 135, 82, 0.18) 0 16%, transparent 17%),
|
| 35 |
+
linear-gradient(130deg, var(--bg-a), var(--bg-b));
|
| 36 |
+
font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
|
| 37 |
+
animation: bg-shift 1.4s ease-out both;
|
| 38 |
+
padding: 28px 18px;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
@keyframes bg-shift {
|
| 42 |
+
from {
|
| 43 |
+
opacity: 0;
|
| 44 |
+
transform: translateY(8px);
|
| 45 |
+
}
|
| 46 |
+
to {
|
| 47 |
+
opacity: 1;
|
| 48 |
+
transform: translateY(0);
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
.shell {
|
| 53 |
+
max-width: 860px;
|
| 54 |
+
margin: 0 auto;
|
| 55 |
+
border: 1px solid var(--line);
|
| 56 |
+
background: var(--panel);
|
| 57 |
+
backdrop-filter: blur(3px);
|
| 58 |
+
box-shadow: var(--shadow);
|
| 59 |
+
border-radius: 18px;
|
| 60 |
+
overflow: hidden;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
.hero {
|
| 64 |
+
padding: 26px 28px 18px;
|
| 65 |
+
border-bottom: 1px solid var(--line);
|
| 66 |
+
background: linear-gradient(135deg, rgba(15, 109, 133, 0.08), rgba(255, 255, 255, 0));
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.eyebrow {
|
| 70 |
+
margin: 0;
|
| 71 |
+
text-transform: uppercase;
|
| 72 |
+
letter-spacing: 0.14em;
|
| 73 |
+
font-size: 11px;
|
| 74 |
+
color: rgba(16, 34, 46, 0.62);
|
| 75 |
+
font-family: "IBM Plex Mono", monospace;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
h1 {
|
| 79 |
+
margin: 8px 0 0;
|
| 80 |
+
font-family: "Archivo Narrow", sans-serif;
|
| 81 |
+
font-size: clamp(1.8rem, 4vw, 2.35rem);
|
| 82 |
+
line-height: 1.08;
|
| 83 |
+
letter-spacing: 0.01em;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.subtext {
|
| 87 |
+
margin: 8px 0 0;
|
| 88 |
+
font-size: 0.97rem;
|
| 89 |
+
color: rgba(16, 34, 46, 0.78);
|
| 90 |
+
max-width: 68ch;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
.content {
|
| 94 |
+
padding: 22px 28px 28px;
|
| 95 |
+
display: grid;
|
| 96 |
+
gap: 14px;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
label {
|
| 100 |
+
display: block;
|
| 101 |
+
font-size: 0.9rem;
|
| 102 |
+
font-weight: 600;
|
| 103 |
+
margin-bottom: 6px;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
input,
|
| 107 |
+
textarea,
|
| 108 |
+
select,
|
| 109 |
+
button {
|
| 110 |
+
font: inherit;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
input,
|
| 114 |
+
textarea,
|
| 115 |
+
select {
|
| 116 |
+
width: 100%;
|
| 117 |
+
border: 1px solid var(--line);
|
| 118 |
+
border-radius: 10px;
|
| 119 |
+
background: #ffffff;
|
| 120 |
+
color: var(--ink);
|
| 121 |
+
padding: 11px 12px;
|
| 122 |
+
transition: border-color 0.16s ease, box-shadow 0.16s ease;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
input:focus,
|
| 126 |
+
textarea:focus,
|
| 127 |
+
select:focus {
|
| 128 |
+
outline: none;
|
| 129 |
+
border-color: rgba(15, 109, 133, 0.66);
|
| 130 |
+
box-shadow: 0 0 0 3px rgba(15, 109, 133, 0.13);
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
textarea {
|
| 134 |
+
min-height: 150px;
|
| 135 |
+
resize: vertical;
|
| 136 |
+
line-height: 1.45;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
.row {
|
| 140 |
+
display: grid;
|
| 141 |
+
gap: 12px;
|
| 142 |
+
grid-template-columns: 1fr;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
@media (min-width: 760px) {
|
| 146 |
+
.row {
|
| 147 |
+
grid-template-columns: 1fr 180px;
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
.actions {
|
| 152 |
+
display: flex;
|
| 153 |
+
align-items: center;
|
| 154 |
+
gap: 10px;
|
| 155 |
+
flex-wrap: wrap;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
button {
|
| 159 |
+
background: linear-gradient(160deg, var(--accent), var(--accent-strong));
|
| 160 |
+
color: #fff;
|
| 161 |
+
border: none;
|
| 162 |
+
border-radius: 10px;
|
| 163 |
+
padding: 10px 16px;
|
| 164 |
+
font-weight: 600;
|
| 165 |
+
cursor: pointer;
|
| 166 |
+
transition: transform 0.13s ease, box-shadow 0.13s ease, opacity 0.2s ease;
|
| 167 |
+
box-shadow: 0 6px 16px rgba(10, 80, 98, 0.28);
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
button:hover {
|
| 171 |
+
transform: translateY(-1px);
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
button:disabled {
|
| 175 |
+
opacity: 0.65;
|
| 176 |
+
cursor: default;
|
| 177 |
+
transform: none;
|
| 178 |
+
box-shadow: none;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
.status {
|
| 182 |
+
font-size: 0.9rem;
|
| 183 |
+
font-family: "IBM Plex Mono", monospace;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
.status.ok {
|
| 187 |
+
color: var(--ok);
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
.status.err {
|
| 191 |
+
color: var(--err);
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
.output-wrap {
|
| 195 |
+
border: 1px solid var(--line);
|
| 196 |
+
border-radius: 12px;
|
| 197 |
+
background: rgba(255, 255, 255, 0.93);
|
| 198 |
+
overflow: hidden;
|
| 199 |
+
animation: reveal 0.35s ease both;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
@keyframes reveal {
|
| 203 |
+
from {
|
| 204 |
+
opacity: 0;
|
| 205 |
+
transform: translateY(5px);
|
| 206 |
+
}
|
| 207 |
+
to {
|
| 208 |
+
opacity: 1;
|
| 209 |
+
transform: translateY(0);
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
.output-head {
|
| 214 |
+
border-bottom: 1px solid var(--line);
|
| 215 |
+
font-family: "IBM Plex Mono", monospace;
|
| 216 |
+
font-size: 12px;
|
| 217 |
+
padding: 8px 12px;
|
| 218 |
+
letter-spacing: 0.02em;
|
| 219 |
+
background: rgba(16, 34, 46, 0.04);
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
pre {
|
| 223 |
+
margin: 0;
|
| 224 |
+
max-height: 380px;
|
| 225 |
+
overflow: auto;
|
| 226 |
+
padding: 14px;
|
| 227 |
+
font-size: 0.88rem;
|
| 228 |
+
line-height: 1.45;
|
| 229 |
+
font-family: "IBM Plex Mono", monospace;
|
| 230 |
+
color: #0f2832;
|
| 231 |
+
background: rgba(255, 255, 255, 0.9);
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
.hint {
|
| 235 |
+
margin-top: 6px;
|
| 236 |
+
font-size: 0.83rem;
|
| 237 |
+
color: rgba(16, 34, 46, 0.66);
|
| 238 |
+
}
|
| 239 |
+
</style>
|
| 240 |
+
</head>
|
| 241 |
+
<body>
|
| 242 |
+
<main class="shell">
|
| 243 |
+
<section class="hero">
|
| 244 |
+
<p class="eyebrow">Hugging Face Space / ASA API</p>
|
| 245 |
+
<h1>Query Console</h1>
|
| 246 |
+
<p class="subtext">
|
| 247 |
+
Enter the GUI password and send a prompt to the ASA backend.
|
| 248 |
+
This page calls <code>/gui/query</code> and returns the same message/parsed output structure as the API.
|
| 249 |
+
</p>
|
| 250 |
+
</section>
|
| 251 |
+
|
| 252 |
+
<section class="content">
|
| 253 |
+
<div class="row">
|
| 254 |
+
<div>
|
| 255 |
+
<label for="password">GUI Password</label>
|
| 256 |
+
<input id="password" type="password" placeholder="Enter GUI_PASSWORD" autocomplete="current-password" />
|
| 257 |
+
</div>
|
| 258 |
+
<div>
|
| 259 |
+
<label for="output-format">Output Format</label>
|
| 260 |
+
<select id="output-format">
|
| 261 |
+
<option value="text">text</option>
|
| 262 |
+
<option value="json">json</option>
|
| 263 |
+
<option value="raw">raw</option>
|
| 264 |
+
</select>
|
| 265 |
+
</div>
|
| 266 |
+
</div>
|
| 267 |
+
|
| 268 |
+
<div>
|
| 269 |
+
<label for="prompt">Prompt</label>
|
| 270 |
+
<textarea id="prompt" placeholder="Ask your question here..."></textarea>
|
| 271 |
+
</div>
|
| 272 |
+
|
| 273 |
+
<div class="actions">
|
| 274 |
+
<button id="submit-btn" type="button">Run Query</button>
|
| 275 |
+
<span id="status" class="status"></span>
|
| 276 |
+
</div>
|
| 277 |
+
|
| 278 |
+
<div class="output-wrap">
|
| 279 |
+
<div class="output-head">Response</div>
|
| 280 |
+
<pre id="output">Awaiting request...</pre>
|
| 281 |
+
</div>
|
| 282 |
+
|
| 283 |
+
<p class="hint">
|
| 284 |
+
API key auth does not apply to this GUI endpoint. Password is checked against <code>GUI_PASSWORD</code> (default <code>999</code> if unset).
|
| 285 |
+
</p>
|
| 286 |
+
</section>
|
| 287 |
+
</main>
|
| 288 |
+
|
| 289 |
+
<script>
|
| 290 |
+
const submitBtn = document.getElementById("submit-btn");
|
| 291 |
+
const passwordInput = document.getElementById("password");
|
| 292 |
+
const promptInput = document.getElementById("prompt");
|
| 293 |
+
const outputFormatInput = document.getElementById("output-format");
|
| 294 |
+
const outputPre = document.getElementById("output");
|
| 295 |
+
const statusEl = document.getElementById("status");
|
| 296 |
+
|
| 297 |
+
function setStatus(text, type) {
|
| 298 |
+
statusEl.textContent = text || "";
|
| 299 |
+
statusEl.className = "status" + (type ? " " + type : "");
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
function setBusy(busy) {
|
| 303 |
+
submitBtn.disabled = !!busy;
|
| 304 |
+
submitBtn.textContent = busy ? "Running..." : "Run Query";
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
async function runQuery() {
|
| 308 |
+
const password = passwordInput.value || "";
|
| 309 |
+
const prompt = promptInput.value || "";
|
| 310 |
+
const outputFormat = outputFormatInput.value || "text";
|
| 311 |
+
|
| 312 |
+
if (!password.trim()) {
|
| 313 |
+
setStatus("Password required.", "err");
|
| 314 |
+
return;
|
| 315 |
+
}
|
| 316 |
+
if (!prompt.trim()) {
|
| 317 |
+
setStatus("Prompt required.", "err");
|
| 318 |
+
return;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
setBusy(true);
|
| 322 |
+
setStatus("Sending request...", "");
|
| 323 |
+
outputPre.textContent = "Working...";
|
| 324 |
+
|
| 325 |
+
try {
|
| 326 |
+
const response = await fetch("/gui/query", {
|
| 327 |
+
method: "POST",
|
| 328 |
+
headers: {
|
| 329 |
+
"Content-Type": "application/json"
|
| 330 |
+
},
|
| 331 |
+
body: JSON.stringify({
|
| 332 |
+
password,
|
| 333 |
+
prompt,
|
| 334 |
+
run: {
|
| 335 |
+
output_format: outputFormat
|
| 336 |
+
}
|
| 337 |
+
})
|
| 338 |
+
});
|
| 339 |
+
|
| 340 |
+
const data = await response.json();
|
| 341 |
+
outputPre.textContent = JSON.stringify(data, null, 2);
|
| 342 |
+
|
| 343 |
+
if (!response.ok || data.status === "error") {
|
| 344 |
+
const errorMessage = data.error || "Request failed.";
|
| 345 |
+
setStatus(errorMessage, "err");
|
| 346 |
+
} else {
|
| 347 |
+
setStatus("Success", "ok");
|
| 348 |
+
}
|
| 349 |
+
} catch (error) {
|
| 350 |
+
outputPre.textContent = JSON.stringify({
|
| 351 |
+
status: "error",
|
| 352 |
+
error: String(error)
|
| 353 |
+
}, null, 2);
|
| 354 |
+
setStatus("Network or server error.", "err");
|
| 355 |
+
} finally {
|
| 356 |
+
setBusy(false);
|
| 357 |
+
}
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
submitBtn.addEventListener("click", runQuery);
|
| 361 |
+
promptInput.addEventListener("keydown", (event) => {
|
| 362 |
+
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
|
| 363 |
+
runQuery();
|
| 364 |
+
}
|
| 365 |
+
});
|
| 366 |
+
</script>
|
| 367 |
+
</body>
|
| 368 |
+
</html>
|