Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
sp12102001 authored Mar 12, 2024
1 parent 472d501 commit 3d5e820
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,29 +107,29 @@ <h1>Tax Bot</h1>
}
});

async function askTaxBot(question) {
try {
displayLoading();

const response = await fetch('https://tax.sp12.workers.dev', {
method: 'POST',
headers: {
'Content-Type': 'text/plain',
},
body: question,
});

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}

const answer = await response.json();
displayAnswer(answer.output);
} catch (error) {
console.error('Error retrieving the answer:', error);
displayError('Sorry, there was a problem retrieving the answer.');
}
}
async function askTaxBot(question) {
try {
displayLoading();

const response = await fetch('https://tax.sp12.workers.dev', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ task: question }),
});

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}

const answer = await response.json();
displayAnswer(answer.output);
} catch (error) {
console.error('Error retrieving the answer:', error);
displayError('Sorry, there was a problem retrieving the answer.');
}
}

function displayLoading() {
document.getElementById('answer').innerHTML = '<div class="loading">Loading...</div>';
Expand Down

0 comments on commit 3d5e820

Please sign in to comment.