Paraphraser

FREEMIUM
Durch Ahmed Javed | Aktualisiert 3 महीने पहले | Text Analysis
Popularität

0 / 10

Latenz

487ms

Service Level

0%

Health Check

N/A

Zurück zu allen Diskussionen

why do i keep getting "undefined" responses?

Rapid account: Bypassgptdetection
bypassgptdetection
एक वर्ष पहले

I’m trying to implement this api into an html code that generates a text box, sends the user inputted text to the api, and has the api return and display the paraphrased text to the user.

Every time i eneter text into this text box however i receive a response reading “undefined”. I checked my logs and the api is successfully receiving and generating an output each time it is called, but the response is always displayed as “undefined”?

Why is this? Any advice to fix this?

Rapid account: Ahmedjaved 701
ahmedjaved701 Commented एक वर्ष पहले

Change this line
then(data => outputTextArea.innerHTML = data.rewrite)
to this line
then(data => outputTextArea.innerHTML = data.response[0])

Rapid account: Bypassgptdetection
bypassgptdetection Commented एक वर्ष पहले

thanks a lot. where exactly do i place this code? i tried implementing it but think i misplaced it because now i’m getting no response displayed.

also, i upgraded my plan so we’ll have more abilities to test.

Rapid account: Ahmedjaved 701
ahmedjaved701 Commented एक वर्ष पहले

document.querySelector(‘button’).addEventListener(‘click’, function() {
const options = {
method: ‘POST’,
headers: {
‘content-type’: ‘application/json’,
‘X-RapidAPI-Key’: ‘453cbd7924msh925043c91be0007p151396jsnd01cedc0bccf’,
‘X-RapidAPI-Host’: ‘paraphraser2.p.rapidapi.com
},
body: JSON.stringify({
variations: 0,
source: ‘en’,
sentence_wise: false,
text: input.value
})
};

fetch('https://paraphraser2.p.rapidapi.com/v2/generate/text', options)
  .then(response => response.json())
  .then(data => outputTextArea.innerHTML = data.response[0])
  .catch(err => console.error(err));

});

This code should work now. Your free daily qouta also been exceeded.

Rapid account: Bypassgptdetection
bypassgptdetection Commented एक वर्ष पहले

My code is below as follows:

<!DOCTYPE html>
<html>
<head>
<meta charset=“UTF-8”>
<title>Text Box Example</title>
</head>
<body>
<center>
<label for=“input-text”>Paste ChatGPT Text:</label>
<br>
<textarea id=“input-text” style=“width: 330px; height: 640px;”></textarea>
<br>
<button onclick=“paraphraseText()”>Generate</button>
<br>
<p id=“output-text”></p>
</center>
<script type=“text/javascript”>
var input = document.getElementById(“input-text”);
var outputTextArea = document.getElementById(“output-text”);

  document.querySelector('button').addEventListener('click', function() {
    const options = {
      method: 'POST',
      headers: {
        'content-type': 'application/json',
        'X-RapidAPI-Key': '453cbd7924msh925043c91be0007p151396jsnd01cedc0bccf',
        'X-RapidAPI-Host': 'paraphraser2.p.rapidapi.com'
      },
      body: JSON.stringify({
        variations: 0,
source: 'en',
sentence_wise: false,
        text: input.value
      })
    };

    fetch('https://paraphraser2.p.rapidapi.com/v2/generate/text', options)
      .then(response => response.json())
      .then(data => outputTextArea.innerHTML = data.rewrite)
      .catch(err => console.error(err));
  });
</script>

</body>
</html>

Rapid account: Ahmedjaved 701
ahmedjaved701 Commented एक वर्ष पहले

Okay, So maybe this issue has something to do with you code logic. Is there any repository where I can see you code in order to help you?

Rapid account: Ahmedjaved 701
ahmedjaved701 Commented एक वर्ष पहले

API seems to be working fine, Can you provide request payload of API you are trying to hit?

Rapid account: Bypassgptdetection
bypassgptdetection Commented एक वर्ष पहले

thank you!

Rapid account: Ahmedjaved 701
ahmedjaved701 Commented एक वर्ष पहले

Hello,

Maybe that has something to do on our side, Let me see it what is the issue and get back to you!

Nehmen Sie an der Diskussion teil - fügen Sie unten einen Kommentar hinzu:

Anmelden / Registrieren, um neue Kommentare zu veröffentlichen