DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
Raw History Blame Contribute Delete
1.44 kB
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>Prompt Response API Fixture</title>
<style>body { font-family: Arial, sans-serif; padding: 24px; } textarea { width: 520px; height: 80px; display: block; } output { display: block; margin-top: 12px; white-space: pre-wrap; }</style>
<script src="config.js"></script>
</head>
<body>
<main>
<label>Prompt<textarea data-testid="prompt-input"></textarea></label>
<button data-testid="send-button">Generate</button>
<h1 data-testid="generated-title">Build a todo app</h1>
<output data-testid="generated-content">Develop a cross-platform mobile app with fake content.</output>
<p data-testid="generation-status">idle</p>
</main>
<script>
async function fakeGenerate(prompt) {
return { title: 'Build a todo app', content: 'Develop a cross-platform mobile app with fake content.' };
}
document.querySelector('[data-testid="send-button"]').addEventListener('click', async () => {
document.querySelector('[data-testid="generation-status"]').textContent = 'complete';
const result = await fakeGenerate(document.querySelector('[data-testid="prompt-input"]').value);
document.querySelector('[data-testid="generated-title"]').textContent = result.title;
document.querySelector('[data-testid="generated-content"]').textContent = result.content;
});
</script>
</body>
</html>