Download task_010/instruction.md from Lego-X/UXInteract: direct link, hf CLI and curl.
- Browser
- Download file 2.79 kB
-
https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_010/instruction.md
- Command line
-
hf download hf://datasets/Lego-X/UXInteract/task_010/instruction.md
-
curl -L -o instruction.md https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_010/instruction.md
Configurable offline title and response streaming
Extend the supplied index.html and config.js to generate a title and streamed response based on the current prompt. Replace the hardcoded sample title and response. The page must open directly from the project root and use a local request layer, with no real API call or extra package installation.
Configuration and request lifecycle
Keep a placeholder-only .env.example with API_KEY, BASE_URL, and MODEL_NAME. The local request layer reads their counterparts key, baseurl, and modelname on window.aiConfig. Reject a missing or whitespace-only value in any field with a visible failure state. Restoring the value allows a new request. Never display a configured key or include it in errors.
On Send, show loading text in the title area (“Loading” or “加载中”) and text or a visible loading indicator with aria-busy="true" in the response area. Generate a single title for this prompt, then show meaningful partial response text before the complete response. Both outputs must depend on the input rather than reuse fixed text or merely echo the prompt. Within five seconds, show “Complete” or “完成” on success and a clear error or timeout on failure (for example “Error” / “错误” or “Timeout” / “超时”).
Local stream interface
- Preserve
data-testidvaluesprompt-input,send-button,generated-title,generated-contentandgeneration-status. Use clear English or Chinese statuses for loading, completion and failure. window.__setMockMode(mode)accepts'normal','timeout'and'malformed'. Timeout ends in a visible failure; normal mode supports recovery. In malformed mode, still decode valid frames such as0:"text"and complete successfully.window.__setMockChunks(chunks)replaces the mock input with an array of complete frame strings or plain text;nullrestores the default. Decode a framed JSON string with its quotes, backslashes and newlines and concatenate text in arrival order without frame prefixes. An invalid frame can produce a clear error or be skipped while valid text is processed. Reassembly of arbitrary network splits is not required.
Acceptance Checklist
- The offline output no longer contains the old canned content. Different prompts produce different, relevant titles and responses.
- Both output areas show loading; visible content grows through an intermediate state before completion.
- Each configuration field is required independently. Restoring a missing value or switching back from timeout permits a new successful request within the time bound without exposing keys.
- Complete frames and plain fragments combine in arrival order, preserving escaped characters and removing wrapper markup.