Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vforvalerio87 committed Oct 21, 2023
1 parent 1fd6965 commit ce388ae
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ <h2>Teach something to the AI</h2>
hx-swap="none"
hx-on::before-send="handleBeforeSend(event)"
hx-on::after-request="handleAfterAdd(event)"
hx-on::after-settle="alert('I learned something new!')"
>
<textarea
name="text"
Expand Down Expand Up @@ -154,40 +153,6 @@ <h2>Talk to the AI about your data</h2>
button.disabled = false
textArea.value = ""
}

function talk2data() {
const prompt = talk2dataText.value

if (!prompt) {
return
}

talk2dataButton.disabled = true
talk2dataText.disabled = true
gptResponse.innerHTML = "Loading..."

fetch('/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt
})
})
.then(res => res.json())
.then(data => {
gptResponse.innerHTML = data.response
talk2dataText.value = ""
})
.catch((err) => {
alert(err.message)
})
.finally(() => {
talk2dataButton.disabled = false
talk2dataText.disabled = false
})
}
</script>
</body>
</html>

0 comments on commit ce388ae

Please sign in to comment.