-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathbing.js
More file actions
26 lines (22 loc) · 713 Bytes
/
bing.js
File metadata and controls
26 lines (22 loc) · 713 Bytes
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
import { BingAIClient } from "@waylaidwanderer/chatgpt-api";
dotenv.config();
const bingAIClient = new BingAIClient({
userToken: process.env.BING_TOKEN, // "_U" cookie from bing.com
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);