transitive-bullshit / bing-chat

Node.js client for Bing's new AI-powered search. It's like ChatGPT on steroids 🔥
MIT License
1.22k stars 128 forks source link

It no longer works #55

Open ByTheFxter opened 11 months ago

ByTheFxter commented 11 months ago

It seems to no longer work, I've tried adding the _U cookie and also tried adding all cookies but it doesn't return any results.

diogo-karma commented 11 months ago

Hi everyone,

I'm also having the same problem. The service worked fine yesterday, but today it's not returning any results. I've tried adding the _U cookie and all cookies, but it's still not working.

evankozliner commented 11 months ago

Same - unsure what changed. Maybe something to do with images?

evankozliner commented 11 months ago

Could be this? https://blogs.bing.com/search/october-2023/DALL-E-3-now-available-in-Bing-Chat-and-Bing-com-create-for-free

diogo-karma commented 11 months ago

Could be this? https://blogs.bing.com/search/october-2023/DALL-E-3-now-available-in-Bing-Chat-and-Bing-com-create-for-free @evankozliner If not, it's too much of a coincidence. Well, it worked fine before.

evankozliner commented 11 months ago

Could be this? https://blogs.bing.com/search/october-2023/DALL-E-3-now-available-in-Bing-Chat-and-Bing-com-create-for-free @evankozliner If not, it's too much of a coincidence. Well, it worked fine before.

yeah this is what I think changed. I've never reconstructed an API before, so this'll be fun

rnz269 commented 11 months ago

@evankozliner I have not either, but may have time to look into this next week. Are you presently attempting to fix?

evankozliner commented 11 months ago

@evankozliner I have not either, but may have time to look into this next week. Are you presently attempting to fix?

Not right this moment. May take a crack at it this weekend though. Could be fun to mob on it

rnz269 commented 11 months ago

@evankozliner @diogo-karma @ByTheFxter @transitive-bullshit I believe I fixed it, made a PR:

While this PR is awaiting review & merge, for use in the meantime, I've published my fork with the fix under bing-chat-rnz.

diogo-karma commented 11 months ago

@evankozliner @diogo-karma @ByTheFxter @transitive-bullshit I believe I fixed it, made a PR:

While this PR is awaiting review & merge, for use in the meantime, I've published my fork with the fix under bing-chat-rnz.

Congratulations @rnz269! which cookie should I use? I would like to test this here. Thank you very much. I saw your fork.

ByTheFxter commented 11 months ago

@evankozliner @diogo-karma @ByTheFxter @transitive-bullshit I believe I fixed it, made a PR:

While this PR is awaiting review & merge, for use in the meantime, I've published my fork with the fix under bing-chat-rnz.

It was able to work, I guess because when I did the demo it took a while to respond. But in its response, the text field returns my answer and not the answer from Bing chat, can you fix it, I will be very grateful to you because I need it for a real project my practice.

rnz269 commented 11 months ago

@diogo-karma _U cookie worked for me.

Will follow up with code examples later today.

rnz269 commented 11 months ago

I tried putting together a repl but I'm running into a websocket error which likely has to do with the replit environment.

That said, I've downloaded it & run the code locally and it works (if you try this, just make sure to include BING_COOKIE in your .env file, which should be set to the _U cookie, and run the dev script listed in the package.json).

I wanted to get the repl working, but unfortunately couldn't and don't have any more time to commit to this.

ByTheFxter commented 11 months ago

I tried putting together a repl but I'm running into a websocket error which likely has to do with the replit environment.

That said, I've downloaded it & run the code locally and it works (if you try this, just make sure to include BING_COOKIE in your .env file, which should be set to the _U cookie, and run the dev script listed in the package.json).

I wanted to get the repl working, but unfortunately couldn't and don't have any more time to commit to this. Thank you very much, thank you for your effort even though it's not perfect

rudrajyotibhattacharya commented 11 months ago

Hi,

I removed bing-chat and installed bing-chat-rnz and tried the same code (except for the import which is now bing-chat-rnz), it gave me the prompt itself as the answer. I used _U cookie. Is there something wrong that I am doing?

ByTheFxter commented 11 months ago

Hi,

I removed bing-chat and installed bing-chat-rnz and tried the same code (except for the import which is now bing-chat-rnz), it gave me the prompt itself as the answer. I used _U cookie. Is there something wrong that I am doing?

That is the same problem we are facing and currently there is no solution for that problem.

rnz269 commented 11 months ago

@rudrajyotibhattacharya @ByTheFxter did you follow the example repl mentioned above https://github.com/transitive-bullshit/bing-chat/issues/55#issuecomment-1751101507?

I'm unable to reproduce your issue; I'm getting the correct response (an answer, not my prompt) from bing.

evankozliner commented 11 months ago

@rudrajyotibhattacharya @ByTheFxter did you follow the example repl mentioned above https://github.com/transitive-bullshit/bing-chat/issues/55#issuecomment-1751101507?

I'm unable to reproduce your issue; I'm getting the correct response (an answer, not my prompt) from bing.

Update: I wound up just checking it out locally, and I also get @rudrajyotibhattacharya 's problem

Might be my inexperience with NPM, but when I try to install the branch with the below, I only get a package.json and package-lock.json

Any tips on how to build your branch from here? Thanks for all the help!

"bing-chat": "rnz269/bing-chat#fix-conversation-signature"

image~~

rudrajyotibhattacharya commented 11 months ago

@rnz269, Firstly, sorry I did not read your post carefully, just noticed "websocket error" and assumed you will be coming up with other examples. Anyway, I tried to simplify your code a little and run it.

I removed the timeout (promise race) and did not use any options (variant).

import { BingChat } from "bing-chat-rnz"

// instantiate the BingChat class
const api = new BingChat({
  cookie:
    "1UKzkhzT5-kSQJtQ-8u9wI-hZ_UjxvQARxVqCWObkQ4zhfaZYbZaqOY1X5pa8_xdrvjwutbwMHFQRfPlwNqvNlPMUf0T8BNQ23wHVTjbT0m8nDwGTZygiC64CkZ_7NnKg67QaZQ4fwz5BcUGBhYlMLFJbpB8uPGWAObyj4UX0HvNcUF13rVg182JOpzd_XbRTxySUYqFJP_ivV1-7X_sm1mNdM9NiJjdX4v_Yq5wIbb9cP57dznehX1y_XfJ8rb2o"
})

async function askBingChat(message, options) {
  const res = await api.sendMessage(message)

  console.log(res);
}

askBingChat("Tell me about themis (TMS) vesting schedule")

The response was the following:

{
  author: 'user',
  id: 'a977bb11-16fc-4a10-999a-16c21e9f741d',
  conversationId: '51D|BingProdUnAuthenticatedUsers|2161B2AAD11353F6CD1F320465DA4F49E54503963969EC2ED5D4D1B9DFD0B380',
  clientId: '985155538178559',
  conversationSignature: 'iPhRXKxdNDX/HwMJ1M1jg+aZqXApo/Dblki7edIvg6sbtKfanP8M6bQxjEScCkHoBGXqQun5YiaWmAOh/nkVpuoxlwJmKWvHptKQRu6ZW0vv4k8gNR1lgdedOYIj28iNu8uEcsLAPeVYtkTMa0mwkvyOsmlABm8UfLDnhvZb3UXUJblZNWhaW5CA0vV98qQ6CJtSNXcz0po0yDa4aIUjXEGniMJc5f1D9Gs3N66fzFt58KcNDKN63HlOFtCZGnedlqOZ87C68fT92dUJ0clE9bwJ9SkB8Ir4dLw0mQTISGU7DdMvjYEdVFTdTB5LlcQQFd0V5hp8a0MgyjhLCzynGFbjSMR6rFVE+X9Zxpnmg/zp3mbc9/HOlMbf8Z8Q5tugJD3NdMxNUkwD76OGajRqfRrNM9NGEdTe69H+A4Y3MmK1YyRni+t/Cbi4XKw7B+zfCndIf2FgH+Er2Niq1m0rTJAkVmAWa122OmFzT0GOQO5niJ2cVOvmqv/4gsG5yodQ/MrgO4uTkNE8tbl3Hes/8qIYmECfXcJhoPlDJS1/vOaTygobNKP54qnIzVPcsZwI/odpvOAR6cCuqlWPhlStxaWY1SxRAomHAQqEfpqsjTuUw6E2beW8Di/qikYfnNeer2ZJlsl4ctyIMM0eCdVFaGTapLQgt8TOyOWxm3zAArokhe0Kf9yjt5Tau+qwqdxJjp2whiNJ33TwWGcLlh3WKVrW7ImkmQ1d44Te0Fihn9VX8TJJPfL9JdKUhE3bbzJtIJ1S2r1OPKS5TBP3lMmN43yrtOG36SNmJOAA8VgsoZeGaqYMQTcwsRYlTtB4n1EzoOpWJN+N/NoBXVNkBMPlos7SqsiXRf8tO0jLggwDnGCi6Ki+SDSxsDIOiiWKRGjWBzCydQYL7+IhGSSoCA3kUiBIdFre6g5mf9eLZEkhjTZKXtQnMkumvnh5ypb3OrL87lx4yyGNMFcy8ZBeT5LDkbS/sppSJ+gyfqEb9vVsA87ittq0OeZ6U9HhEfOB2FmV1CwDMsYrEmx6cneVTz1u8r76U2N+sLFGFaC2LQDKnIo=',
  invocationId: '2',
  text: 'Tell me about themis (TMS) vesting schedule',
  conversationExpiryTime: '2023-10-09T08:55:48.2202462Z',
  detail: {
    text: 'Tell me about themis (TMS) vesting schedule',
    author: 'user',
    from: { id: '985155538178559', name: null, partnerId: null },
    createdAt: '2023-10-09T02:54:57.8196721+00:00',
    timestamp: '2023-10-09T02:54:57.8146526+00:00',
    locale: 'en-US',
    market: 'en-US',
    region: 'US',
    locationInfo: { country: 'India', state: 'West Bengal', city: 'Kolkata' },
    messageId: '3387d0c5-3082-417e-8392-94af335d9763',
    requestId: '3387d0c5-3082-417e-8392-94af335d9763',
    nlu: {
      scoredClassification: [Object],
      classificationRanking: [Array],
      qualifyingClassifications: null,
      ood: null,
      metaData: null,
      entities: null
    },
    offense: 'None',
    feedback: { tag: null, updatedOn: null, type: 'None' },
    contentOrigin: 'cib',
    scores: [ [Object], [Object] ],
    inputMethod: 'Keyboard'
  }
}

Then I introduced the options

const res = await api.sendMessage(message, { variant: 'Precise' })

The prompt was "Tell me about bitcoin"

{
  author: 'bot',
  id: 'd4b9594c-a0cd-4c7e-8805-088e6b11e84f',
  conversationId: '51D|BingProdUnAuthenticatedUsers|69BF3EC907ABAF14C79DF808B1ACE3EA3B52C0D71FAC339160935D8CA68AD899',
  clientId: '985155538178559',
  conversationSignature: 'RASHnt/OocH2W51prnIR9chF1y0oMeiEjiGIX2d8GCDM9cc3oQ3WWvDH+MXJUewPtleDMZGQ/lGrfNcW0/JpdQ0GIQw9nERPf4uKneIh7kdZ3za/dSoDoQOBe9i520A4K9oH6eebpwIhnz6/Jndx9Us9E9pTK2jXtCXXLmMbqz+xghmF9qi43yeROA0rtQEzpftBWZB3oaIAL82MpnN2VuzS/zbiJaCxtZ0wohwOCJ5TSJ7INv4PJT5yz6/K5B4L/gtlV3TK/5ya1WKdq5pLhXXOkA0sBMAPJEtCGVDlajvPNss1cpq6Kev2wRoK41sZeaM5m3isSSTFEJKEkPwhq46cXpajCIt6gXtpFY/HgPpBYRZCI1CcQfYy3M8wzGOGd5r41R6Q1AM+eriy/dT4rg8KLdjTiF6Y1heGLaktlh4otnXjZx/po2S1DOoIVNpm6ceGoZcHLMTsglK8vz/n/ZdXVQY+Tt3d8WP3mOb2ksb2xST75xwSRSGOKvCGfFIcNjLKKH0UFOIKQQvMfcxKYfXzjhkup23giEYwjJlC7uI7FpaJANRwpcZOhRI7hiJAvnHISTbzPOrFxf39N8FTTkxMaxWkFLZMyh77AcZvl4zvWhF0ijHjAGfYVtvrk4lVD8VD8YJzz+1numwoorOY8cvSSlaE7TcqWqrjqC26RuzpgtY5Pr2+6BMaT7EWsahLsaxSpVMeEXD1MjvdfXhe/7pS83uaNvuz3JpZmJgXhJuH1uCYVkLuTecI1xdJQ9Pxnu5CQIJsMs8AKcC68RDIUbOYFmKZCPuwtVAfWTrh0VZuzGtb+xD0OD3SUG/MzcpKkPabfa5uKLanlQ4o7z+GIytvg3gHOC6R5tY4YM4CyFXOLfcfi4+42FjmtJodEe6XmF7JlVb6H+1jHh+N+1bOaQfa012+mQNJ8NmczWf+r096xsOrodAqkC0073TmAmD3k7PuOmJUq+N2LUwTAhtto2C2boDs2TlvGhwLub4+C+M2avUcACtP9AdugNsII7UIUfx7FXcgdOgs/q7MZ1L3h+BfUQqhhRgcsCz/ZCY/r9w=',
  invocationId: '2',
  text: 'Bitcoin is a decentralized cryptocurrency originally described in a 2008 whitepaper by a person, or group of people, using the alias Satoshi Nakamoto[^2^]. It was launched soon after, in January 2009[^2^]. Bitcoin is a peer-to-peer online currency, meaning that all transactions happen directly between equal, independent network participants, without the need for any intermediary to permit or facilitate them[^2^].\n' +
    '\n' +
    'Bitcoin was created to allow "online payments to be sent directly from one party to another without going through a financial institution"[^2^]. Bitcoin holds the distinction of being the first-ever cryptocurrency to come into actual use[^2^].\n' +
    '\n' +
    "Bitcoin's original inventor is known under a pseudonym, Satoshi Nakamoto. As of 2021, the true identity of the person — or organization — that is behind the alias remains unknown[^2^]. On October 31, 2008, Nakamoto published Bitcoin’s whitepaper, which described in detail how a peer-to-peer, online currency could be implemented[^2^].\n" +
    '\n' +
    'Just two months later, on January 3, 2009, Nakamoto mined the first block on the Bitcoin network, known as the genesis block, thus launching the world’s first cryptocurrency[^2^]. Bitcoin price was $0 when first introduced, and most Bitcoins were obtained via mining[^2^].\n' +
    '\n' +
    'The first known Bitcoin commercial transaction occurred on May 22, 2010, when programmer Laszlo Hanyecz traded 10,000 Bitcoins for two pizzas[^2^]. In July 2010, Bitcoin first started trading[^2^].\n' +
    '\n' +
    'As of now, **1.00 BTC is equal to 27,929.00 USD**[^1^]..',
  detail: {
    text: 'Bitcoin is a decentralized cryptocurrency originally described in a 2008 whitepaper by a person, or group of people, using the alias Satoshi Nakamoto[^2^]. It was launched soon after, in January 2009[^2^]. Bitcoin is a peer-to-peer online currency, meaning that all transactions happen directly between equal, independent network participants, without the need for any intermediary to permit or facilitate them[^2^].\n' +
      '\n' +
      'Bitcoin was created to allow "online payments to be sent directly from one party to another without going through a financial institution"[^2^]. Bitcoin holds the distinction of being the first-ever cryptocurrency to come into actual use[^2^].\n' +
      '\n' +
      "Bitcoin's original inventor is known under a pseudonym, Satoshi Nakamoto. As of 2021, the true identity of the person — or organization — that is behind the alias remains unknown[^2^]. On October 31, 2008, Nakamoto published Bitcoin’s whitepaper, which described in detail how a peer-to-peer, online currency could be implemented[^2^].\n" +
      '\n' +
      'Just two months later, on January 3, 2009, Nakamoto mined the first block on the Bitcoin network, known as the genesis block, thus launching the world’s first cryptocurrency[^2^]. Bitcoin price was $0 when first introduced, and most Bitcoins were obtained via mining[^2^].\n' +
      '\n' +
      'The first known Bitcoin commercial transaction occurred on May 22, 2010, when programmer Laszlo Hanyecz traded 10,000 Bitcoins for two pizzas[^2^]. In July 2010, Bitcoin first started trading[^2^].\n' +
      '\n' +
      'As of now, **1.00 BTC is equal to 27,929.00 USD**[^1^]..',
    author: 'bot',
    createdAt: '2023-10-09T03:21:05.9183795+00:00',
    timestamp: '2023-10-09T03:21:05.9183795+00:00',
    messageId: 'cb5a74ae-4fe2-4468-b79c-819be798a385',
    requestId: '6046e69a-6117-4cd3-ad4f-3568cb0d098f',
    offense: 'None',
    adaptiveCards: [ [Object] ],
    sourceAttributions: [
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object]
    ],
    feedback: { tag: null, updatedOn: null, type: 'None' },
    contentOrigin: 'DeepLeo',
    scores: [ [Object], [Object], [Object], [Object], [Object] ],
    suggestedResponses: [ [Object], [Object], [Object] ]
  },
  conversationExpiryTime: '2023-10-09T09:21:08.4877977Z'
}

A sight for sore eyes :)

Maybe a default variant is a good idea because in the bing-chat package we did not need to pass this option. But anyway, thanks a million.

rudrajyotibhattacharya commented 11 months ago

@evankozliner, just do an npm install bing-chat-rnz in your working directory.

evankozliner commented 11 months ago

Nice! Adding the precise prompt solved the repeat-prompt response problem for me too

diogo-karma commented 11 months ago

@rnz269 it worked perfectly. thank you very much. you are a genius!

Aube33 commented 11 months ago

Hi, I tried that code

import { BingChat } from "bing-chat-rnz"

// instantiate the BingChat class
const api = new BingChat({
  cookie:
    "<mycookie _U>"
})

async function askBingChat(message, options) {
  const res = await api.sendMessage(message)

  console.log(res);
}

askBingChat("Tell me about themis (TMS) vesting schedule")

But my response is

{
  author: 'bot',
  id: '6e31ac9b-4143-43b7-8c98-246dd3e03aab',
  conversationId: '51D|BingProdUnAuthenticatedUsers|CF68F5D46BC876FE8781698447B20E73441CB5BD2A61D68499B80EB0293C86B5',
  clientId: '914802258512686',
  conversationSignature: 'hl8g4deMRA/xZCFk84Z+GhklqeiQOe9HUZqTlYSr+r0C3zVQMuBqnHzYYixyL/suvEQbE6Ql/KGr/a3ktVoSvYMZ4k36PWplLXY9QE3+E6/A1H60gL3ULpojpFdQimukZVoPETHR5ovDFoH1MW5b8DIfLAbdwKAvumFOlJ2e/9MyTy/6WGmCTNmGkOCuz9j3E9zRSiDrLvGE2vn2NIXNijkUknotoPga5Z65k/dI0mpJwbnVQ/2RcFz7aEvktKeZIap5ZsQsNHoB/wt3CLKPHTMU47YTSD1julWP2E7JIfBOSEnlv7mAoJFhHkQCUxiIAXmDXugdi01vYf9inBJD4BMqOYfyI7whSXutpjM3A1TEdL1oQyO2bozlsJ0UBtqx+qqsUotxDfJY3eNfxy9ilCOqg4afTNB7X10LBLFYSugUDJoQECWAYSIw8mMnM2huqiYzVz5qebUGcXUFfN3JdsmnM7E/6FjCbJAegN1bL8j1EDU+Wzd2Jpd95JPDW05usdXlpVnZpp/IYECQVa8RrD5LGRfu96it/QRx8gZrgMw8RxR+dyAz+qh6CORG9KMJm5sTDmJZhLUnFCFWzQmiBv42xKb4DU263BEwVJKNMinz9fiDV/Xc3La9DuYVNtdK4Ms86KAm/75PtYhx7gIBdNDQDOfkKTmxYAphIecZuBzwIsv/HOvUuRaAproOOvSF5/O9/o56ARdZ42XsdeGgsbMuFFLszK8sqE9dWqJ50gI/fd5ahXiwI65pZiNqshOIfRMyn4R6spYUYg+nY8ofDCeT26SREWU1WuaammU52CHsrc2Fuk5UY8+CGqghGfR9HDwc3n/e+69FpxKtM2QJPIVy4uTd92q2NA8L3A42PP5iZz8eTgOe0JAP9UsAxJ3mJMYm3F56FR1gAt90myxP0ysnCg9D3oSfzgbkzY23zLUA4BX8LBN66LbaBzbMyK5iyeWfTDyJsVdl3EP0VIplEQ8ly626xAxTtyJIMziAsHO02xCU1gk+teC2aqWSF58+h99SUyTXTPfUrhnT9s6QFuaCiaKhkRvbhYMyVqVOEnM=',
  invocationId: '2',
  text: ''
}

Is my problem related to the fix or not at all ?

shuaibaslam2019 commented 11 months ago

Hi, I tried that code

import { BingChat } from "bing-chat-rnz"

// instantiate the BingChat class
const api = new BingChat({
  cookie:
    "<mycookie _U>"
})

async function askBingChat(message, options) {
  const res = await api.sendMessage(message)

  console.log(res);
}

askBingChat("Tell me about themis (TMS) vesting schedule")

But my response is

{
  author: 'bot',
  id: '6e31ac9b-4143-43b7-8c98-246dd3e03aab',
  conversationId: '51D|BingProdUnAuthenticatedUsers|CF68F5D46BC876FE8781698447B20E73441CB5BD2A61D68499B80EB0293C86B5',
  clientId: '914802258512686',
  conversationSignature: 'hl8g4deMRA/xZCFk84Z+GhklqeiQOe9HUZqTlYSr+r0C3zVQMuBqnHzYYixyL/suvEQbE6Ql/KGr/a3ktVoSvYMZ4k36PWplLXY9QE3+E6/A1H60gL3ULpojpFdQimukZVoPETHR5ovDFoH1MW5b8DIfLAbdwKAvumFOlJ2e/9MyTy/6WGmCTNmGkOCuz9j3E9zRSiDrLvGE2vn2NIXNijkUknotoPga5Z65k/dI0mpJwbnVQ/2RcFz7aEvktKeZIap5ZsQsNHoB/wt3CLKPHTMU47YTSD1julWP2E7JIfBOSEnlv7mAoJFhHkQCUxiIAXmDXugdi01vYf9inBJD4BMqOYfyI7whSXutpjM3A1TEdL1oQyO2bozlsJ0UBtqx+qqsUotxDfJY3eNfxy9ilCOqg4afTNB7X10LBLFYSugUDJoQECWAYSIw8mMnM2huqiYzVz5qebUGcXUFfN3JdsmnM7E/6FjCbJAegN1bL8j1EDU+Wzd2Jpd95JPDW05usdXlpVnZpp/IYECQVa8RrD5LGRfu96it/QRx8gZrgMw8RxR+dyAz+qh6CORG9KMJm5sTDmJZhLUnFCFWzQmiBv42xKb4DU263BEwVJKNMinz9fiDV/Xc3La9DuYVNtdK4Ms86KAm/75PtYhx7gIBdNDQDOfkKTmxYAphIecZuBzwIsv/HOvUuRaAproOOvSF5/O9/o56ARdZ42XsdeGgsbMuFFLszK8sqE9dWqJ50gI/fd5ahXiwI65pZiNqshOIfRMyn4R6spYUYg+nY8ofDCeT26SREWU1WuaammU52CHsrc2Fuk5UY8+CGqghGfR9HDwc3n/e+69FpxKtM2QJPIVy4uTd92q2NA8L3A42PP5iZz8eTgOe0JAP9UsAxJ3mJMYm3F56FR1gAt90myxP0ysnCg9D3oSfzgbkzY23zLUA4BX8LBN66LbaBzbMyK5iyeWfTDyJsVdl3EP0VIplEQ8ly626xAxTtyJIMziAsHO02xCU1gk+teC2aqWSF58+h99SUyTXTPfUrhnT9s6QFuaCiaKhkRvbhYMyVqVOEnM=',
  invocationId: '2',
  text: ''
}

Is my problem related to the fix or not at all ?

I am getting the same. Text is empty. @rudrajyotibhattacharya @diogo-karma @evankozliner Could you please tell what we are doing wrong?

It would be a great help.

Many thanks!

rnz269 commented 11 months ago

@rudrajyotibhattacharya thank you for reviewing the code in detail and noticing the issue with the default variant.

It turns out, the issue was not that the default variant (Balanced) was not being provided to the BingChat class, it was rather that my solution introduced a bug with Balanced that led it to just re-print the input message. So, anyone who tried to use the class without specifying the Precise or Creative variants received a response containing their original input.

I just fixed this and published a new variant to npm. So after installing the latest version, the Balanced variant will be working again, and so the default case where no variant is specified will work.

Sadly, I don't have time to answer everyone else's questions, but hopefully upgrading to the latest version of bing-chat-rnz. and/or checking out the example I put together earlier will help.

rnz269 commented 11 months ago

I will also say, to those who are receiving empty messages back from the API, you may need a new _U cookie.

  1. Open up the edge browser
  2. Clear your cookies.
  3. Sign into your Bing account.
  4. Send a new message in the bing chat web gui.
  5. Check console, application tab, grab _U cookie, and paste this into your app as an env variable.

I find myself having to do this each day. This process is manual. I noticed that there's a new conversation around automatic _U cookie generation, though: https://github.com/transitive-bullshit/bing-chat/issues/57

rudrajyotibhattacharya commented 11 months ago

Most welcome @rnz269.

I will just point out one issue regarding blank response. From time to time, Bing presents logged in users a captcha even if they have not rolled the cookie. So just opening bing chat from browser and writing any message will present a captcha. Once you clear it, the same cookie will work in the API.

diogo-karma commented 10 months ago

Here is a working example using @rnz269 module. A simple javascript/Nodejs with expressjs code

  1. git clone https://github.com/diogo-karma/bingchat-expressjs
  2. npm install
  3. npm start

Since I used express, you can access (for example) the browser or curl: http://localhost:3000/api?prompt=Create%20a%20poem%20about%20JavaScript%20loops&variant=Creative

Remembering that it is necessary to edit the .env file.

I used the module "bing-chat-rnz": "^0.2.4"

try this @shuaibaslam2019 @Aube33

@rudrajyotibhattacharya (ur right, but cases are rare)

thx @ByTheFxter @rnz269

An easy way to know the _U Cookie using Google Console / DevTools / Console; Just use this simple script (copy&past)

let cookie_U = await cookieStore.getAll(); cookie_U.find(i => i.name == `_U`).value

britneypicciuy commented 10 months ago

It no longer works. And I updated bing-chat-rnz to the latest version, use many solutions of this thread, use the _U token but it no longer works. Now that they don't use _U cookie anymore. They don't call https anymore. They use WebSocket now. Can someone do it right now?

diogo-karma commented 10 months ago

Hi @britneypicciuy, I was able to get bing-chat-rnz working locally after updating to the latest version from @rnz269. I put together a small Express app as an example. It takes a bit of setup with the .env file, but I was able to get it working (just tested again now locally).

You can try it out locally with this repo: https://github.com/diogo-karma/bingchat-expressjs

git clone git@github.com:diogo-karma/bingchat-expressjs.git cd bingchat-expressjs cp .env.example .env vim .env #add _U token npm install npm start

Then open in browser or curl: http://localhost:3000/api?prompt=Create%20a%20poem%20about%20JavaScript%20loops&variant=Creative

Caveat: There is a delay, but it works. I repeat, and I tested locally and with a browser open with Bing.

Let me know if you have any other questions!

britneypicciuy commented 10 months ago

I have already cloned your repo. But with my old _U token, it no longer work. I cannot get the new _U token in www.bing.com. Can you share your _U if it works for testing purpose?

diogo-karma commented 10 months ago

@britneypicciuy yep. https://www.bing.com/chat

Google Chrome Extension (for cookies): https://chrome.google.com/webstore/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm

or (chrome webdev tools) console:

let cookie_U = await cookieStore.getAll(); cookie_U.find(i => i.name == '_U').value

must be in the same tab bing.com/chat or bing.com/search

I have already cloned your repo. But with my old _U token, it no longer work. I cannot get the new _U token in www.bing.com. Can you share your _U if it works for testing purpose?

britneypicciuy commented 10 months ago

Cannot get it.

Screenshot 2023-10-16 at 10 03 14 Screenshot 2023-10-16 at 10 03 32
diogo-karma commented 10 months ago

@britneypicciuy That seems odd. Are you logged in? If so, have you tried accessing it through the Google extension at bign.com/chat? I’m currently logged in and this has been tested in Brazil. It might be an issue specific to your country. If you’re logged in, you might want to try using a VPN. I recommend using Proton.me, which is free, and setting your location to somewhere else.

cookie-2 cookie-1