bing-chat icon indicating copy to clipboard operation
bing-chat copied to clipboard

Use in a normal nodejs program...

Open Zibri opened this issue 9 months ago • 3 comments

after issuing npm install bing-chat, I tried this:

$ cat >chat.js
   import { BingChat } from 'bing-chat';

   async function main() {
       // Initialize the API with your valid cookie
       const api = new BingChat({ cookie: process.env.BING_COOKIE });

       // Send a message to Bing Chat
       const response = await api.sendMessage('Hello, how can I help?');
       console.log('Bing Chat response:', response.text);
   }

   main();

then node chat.js

obviously import can't be used outside a module so it does not work. how can I use it in a normal main.js file executed as node main.js ?

Zibri avatar May 02 '24 13:05 Zibri

Done:

import('bing-chat').then(_=>{

   BingChat=_.BingChat;
   async function main() {
       // Initialize the API with your valid cookie
       const api = new BingChat({ cookie: process.env.BING_COOKIE });

       // Send a message to Bing Chat
       const response = await api.sendMessage('Hello, how can I help?');
       console.log('Bing Chat response:', response.text);
   }

   main();

});

Zibri avatar May 02 '24 13:05 Zibri

i am getting blank response. any ideas ? also my cookies do not have any _U cookie, did anything change in Bing ?

carefulcomputer avatar May 03 '24 16:05 carefulcomputer

i am getting blank response. any ideas ? also my cookies do not have any _U cookie, did anything change in Bing ?

same with me

murnifine avatar May 17 '24 17:05 murnifine