Skip to content

Commit

Permalink
seems like the delay is no longer needed and hence the async/await too
Browse files Browse the repository at this point in the history
  • Loading branch information
EnderPoint07 committed Oct 22, 2023
1 parent feb2862 commit 1e894eb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ function removeTypingIndicator() {
}
}

async function sendUserMessageToAI(userMessage) {
function sendUserMessageToAI(userMessage) {
const apiUrl = 'https://gpt4free.dotm38.repl.co/custom/api/conversation';

await fetch(apiUrl, {
fetch(apiUrl, {
method: 'POST',
headers: {
'content-type': "application/json",
Expand All @@ -48,7 +48,6 @@ async function sendUserMessageToAI(userMessage) {
}
})
})
.then(await new Promise(r => setTimeout(r, 5000)))
.then(response => response.text())
.then(text => {
const botResponse = text
Expand Down

0 comments on commit 1e894eb

Please sign in to comment.