randydev commited on
Commit
419fa76
·
verified ·
1 Parent(s): 3cb6e84

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +4 -2
index.js CHANGED
@@ -39,8 +39,10 @@ const OpenaiRes = async (prompt) => {
39
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134"
40
  };
41
  const response = await axios.post(url, payload(prompt), { headers, timeout: 50000 });
42
- console.log("Response:", response)
43
- return response.data.choices[0].message.content + "\n\nPowered By xtdevs";
 
 
44
  } catch (error) {
45
  console.error("Error:", error.message);
46
  return null;
 
39
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134"
40
  };
41
  const response = await axios.post(url, payload(prompt), { headers, timeout: 50000 });
42
+ if (response.status === 200) {
43
+ return response.data.choices[0].message.content + "\n\nPowered By xtdevs";
44
+ }
45
+ // console.log("Response:", response)
46
  } catch (error) {
47
  console.error("Error:", error.message);
48
  return null;