forked from waylaidwanderer/node-chatgpt-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
use-bing-client.js
32 lines (29 loc) · 1019 Bytes
/
use-bing-client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { BingAIClient } from '../index.js';
const bingAIClient = new BingAIClient({
// Necessary for some people in different countries, e.g. China (https://cn.bing.com)
host: '',
// "_U" cookie from bing.com
userToken: '',
// If the above doesn't work, provide all your cookies as a string instead
cookies: '',
// A proxy string like "http://<ip>:<port>"
proxy: '',
// (Optional) Set to true to enable `console.debug()` logging
debug: false,
});
let response = await bingAIClient.sendMessage('Write a short poem about cats', {
onProgress: (token) => {
process.stdout.write(token);
},
});
console.log(response);
response = await bingAIClient.sendMessage('Now write it in French', {
conversationSignature: response.conversationSignature,
conversationId: response.conversationId,
clientId: response.clientId,
invocationId: response.invocationId,
onProgress: (token) => {
process.stdout.write(token);
},
});
console.log(response);