ai-npcs-x / cubzh.html
AEUPH's picture
Update cubzh.html
ba4ebd2 verified
raw
history blame
1.22 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NPC Chat Interface</title>
</head>
<body>
<div id="npc-chat-container">
<p id="npc-response">NPC is waiting...</p>
<input type="text" id="player-input" placeholder="Type your message here..." />
<button id="send-button">Send</button>
</div>
<script>
document.getElementById('send-button').addEventListener('click', async function () {
const playerInput = document.getElementById('player-input').value;
const npcResponseElement = document.getElementById('npc-response');
// Call the LLM API
const response = await fetch('https://api.your-llm.com/inference', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ prompt: playerInput }),
});
const data = await response.json();
npcResponseElement.textContent = data.response; // Assuming the LLM response is in data.response
});
</script>
</body>
</html>