Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use in a normal nodejs program... #70

Open
Zibri opened this issue May 2, 2024 · 3 comments
Open

Use in a normal nodejs program... #70

Zibri opened this issue May 2, 2024 · 3 comments

Comments

@Zibri
Copy link

Zibri commented May 2, 2024

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
Copy link
Author

Zibri commented May 2, 2024

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();

});

@carefulcomputer
Copy link

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

@murnifine
Copy link

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

same with me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants