Use in a normal nodejs program...
Zibri opened this issue · 3 comments
Zibri commented
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 commented
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 commented
i am getting blank response. any ideas ? also my cookies do not have any _U cookie, did anything change in Bing ?
murnifine commented
i am getting blank response. any ideas ? also my cookies do not have any _U cookie, did anything change in Bing ?
same with me