Skip to content

Commit

Permalink
- fix api and function call
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasMue91 committed Feb 7, 2024
1 parent 5f29da3 commit 70e7790
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tools/opposite_finder.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ <h1 class="text-2xl font-bold text-center mb-4">OppositeFinder</h1>
const creativityValue = document.getElementById('creativity').value;
document.getElementById('creativity-value').textContent = `${creativityValue}%`;
});
document.getElementById('find-opposite').addEventListener('click', findOpposite);

async function findOpposite() {
const creativitySlider = document.getElementById('creativity');
Expand All @@ -42,12 +43,23 @@ <h1 class="text-2xl font-bold text-center mb-4">OppositeFinder</h1>
let userMessage = `Find opposites for: ${inputText}`;

try {
const response = await fetch('https://yourapiendpoint.com/findopposites', {
const response = await fetch('https://chatgpt.tobiasmue91.workers.dev/', {
method: 'POST',
headers: {"Content-Type": "application/json", "Accept": "*/*"},
body: JSON.stringify({
input: inputText,
creativity: creativity
model: "gpt-3.5-turbo",
max_tokens: 100,
temperature: creativity * 2,
messages: [
{
role: "assistant",
content: botMessage,
},
{
role: "user",
content: userMessage,
},
],
})
});

Expand Down

0 comments on commit 70e7790

Please sign in to comment.