Download task_013/solution/code/index.html from Lego-X/UXInteract: direct link, hf CLI and curl.
- Browser
- Download file 1.97 kB
-
https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_013/solution/code/index.html
- Command line
-
hf download hf://datasets/Lego-X/UXInteract/task_013/solution/code/index.html
-
curl -L -o index.html https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_013/solution/code/index.html
1.97 kB
| <html><head><meta charset="utf-8"><title>Follow Up Prompt</title></head> | |
| <body> | |
| <header> | |
| <h1>Demo 1001</h1> | |
| <p>Click the button below to start a question. After sending, a follow-up input will appear and receive focus automatically.</p> | |
| </header> | |
| <main data-testid="demo-1001-page"> | |
| <p class="hint">Write and press the button to continue with follow-up questions.</p> | |
| <button data-testid="write-trigger">Write, press ..</button> | |
| <div data-testid="prompt-area"></div> | |
| </main> | |
| <script> | |
| const submissions=[];window.__getSubmissions=()=>submissions.slice(); | |
| const area = document.querySelector('[data-testid="prompt-area"]'); | |
| function wireFollowup(input) { | |
| input.addEventListener('keydown', event => { | |
| if (event.key === 'Enter' && !event.shiftKey && !event.isComposing) { | |
| event.preventDefault(); | |
| submissions.push(input.value); | |
| const result=document.createElement('div');result.dataset.testid='submitted-followup';result.textContent='submitted '+input.value;area.appendChild(result); | |
| } | |
| }); | |
| } | |
| document.querySelector('[data-testid="write-trigger"]').addEventListener('click', () => { | |
| area.innerHTML = '<input data-testid="prompt-input" placeholder="Ask"><button data-testid="send-button">Send</button>'; | |
| area.querySelector('[data-testid="send-button"]').addEventListener('click', () => { | |
| submissions.push(area.querySelector('[data-testid=prompt-input]').value); | |
| const answer = document.createElement('div'); | |
| answer.dataset.testid = 'answer'; | |
| answer.textContent = submissions.at(-1); | |
| area.append(answer); | |
| area.insertAdjacentHTML('beforeend', '<input data-testid="followup-input" placeholder="Follow up">'); | |
| const followup = area.querySelector('[data-testid="followup-input"]'); | |
| wireFollowup(followup); | |
| followup.focus(); | |
| }); | |
| }); | |
| </script> | |
| </body></html> | |