tuhinpal / bingchat-api

Bing Chat unofficial API
MIT License
164 stars 38 forks source link

error when pasted into console #11

Open CopyNinja1999 opened 11 months ago

CopyNinja1999 commented 11 months ago

Got this error when pasted into console

const cookie = document.cookie;
const serverUrl = "http://192.168.110.20:8080";

fetch(`${serverUrl}/set-cookie`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ cookie }),
})
  .then((res) => res.json())
  .then((res) => console.log(res))
  .catch((err) => console.log(err));
Mixed Content: The page at 'https://www.bing.com/search?q=Bing+AI&showconv=1&FORM=hpcodx' was loaded over HTTPS, but requested an insecure resource 'http://192.168.110.20:8080/set-cookie'. This request has been blocked; the content must be served over HTTPS.
typoworx-de commented 7 months ago

This doesn't work because of limitation to send from https://bing.com (https environment) to non-secure http! Even the original example using http://localhost -- which is in most browser not handled strict for https<>http) didn't work for me on recent google-chrom(e|ium) Browser.

If you use this in your own app/implementation simply send the cookie yourself:

POST http://192.168.110.20/set-cookie headers: [ 'Content-Type' => 'application/json' ] data: [ 'cookie' => 'MUID=0883xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ]

then fetch identifiers: POST http://192.168.110.20//create-conversation

and with that one should be able to enter into /generation identifiers even contain parameter conversationPath which seems to have relative url-path including all required parameters.

But at least with PHP/Laravel I'm still running into 200 OK, but NO DATA response.

typoworx-de commented 7 months ago

Just noticed the last response for /generate was no json in my case:

data: [ERROR] Missing required parameters: conversationId, clientId, conversationSignature, text
data: [END]

So there's somewhere else the culprit for missing conversationSignature