Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download web/js/space-task-view.js from FineEnvs/RL-Explorer: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/spaces/FineEnvs/RL-Explorer/resolve/main/web/js/space-task-view.js
- Command line
-
hf download hf://spaces/FineEnvs/RL-Explorer/web/js/space-task-view.js
-
curl -L -o space-task-view.js https://huggingface.co/spaces/FineEnvs/RL-Explorer/resolve/main/web/js/space-task-view.js
1.37 kB
| import { esc, fmt } from "./util.js"; | |
| import { value } from "./render.js"; | |
| // Keep the task's actual inputs visible; hashes and bookkeeping belong in an | |
| // expandable record. All content still passes through the shared safe renderer. | |
| export function taskContent(task) { | |
| const primary = /^(prompt|instruction|instructions|question|description|messages|input|inputs|content|text|audio|audio_url|image|image_url|video_url|context|tools)$/i; | |
| const entries = Object.entries(task); | |
| const inputs = entries.filter(([key, v]) => primary.test(key) && v != null && v !== ""); | |
| const metadata = Object.fromEntries(entries.filter(([key]) => !primary.test(key))); | |
| return `${task.media_ready === false ? `<div class="note-box"><span><b>Media loads when the episode starts.</b> Start this task to ask the Space to prepare its asset. The player appears with the observation when the server provides it.</span></div>` : ""} | |
| <div class="tk-inputs">${inputs.map(([key, v]) => `<section><h3>${esc(key.replaceAll("_", " "))}</h3>${value(v, key, 0, task)}</section>`).join("") || `<p class="muted sm">This task exposes structured fields. Open its record below to inspect them.</p>`}</div> | |
| <details class="tk-record" ${inputs.length ? "" : "open"}><summary>Task record · ${fmt.format(Object.keys(metadata).length)} fields</summary> | |
| ${value(metadata)}</details>`; | |
| } | |