Bing Copilot Async Client
features
default = ["rustls"]
Using rustls by default makes it simpler to compile across platforms.
If you want to use native-tls, you can use {------, features = ["native-tls"],default-features = false}
the cookie to build client
You can use one of the enum to build a client;
The cookie can be got by using Cookie Editor or other browser extensions.
(Also you can you javascript to get it by yourself)
build a client without chats
use BingClient;
async
build a client with chats
let client = build
.await
.unwrap;
client.chats.iter.for_each;
Serialize and Deserialize a client
let client = build.await.unwrap;
let client_str = to_string.unwrap;
let client = .unwrap;
Get chat list
let chats = client.get_chat_list.await.unwrap;
Create a new chat
let chat = client.create_chat.await.unwrap;
Delete a chat
client.delete_chat.await.unwrap;
Rename a chat
client..rename_chat.await.unwrap;
Get chat messages
let messages = client.get_chat_messages.await.unwrap;
Ask question in a chat, and get only string(markdown) reply
let client = build.await.unwrap;
let mut new_chat = client.create_chat.await.unwrap;
let user_input = build
.await
.unwrap;
let = client
.ask_stream_plain
.await
.unwrap;
while let Yielded = stream.async_resume.await
Ask question in a chat, and get muti type reply
let client = build.await.unwrap;
let mut new_chat = client.create_chat.await.unwrap;
let user_input = build
.await
.unwrap;
let = client
.ask_stream
.await
.unwrap;
while let Yielded = stream.async_resume.await
Stop answering
let client = build
.await
.unwrap;
let mut new_chat = client.create_chat.await.unwrap;
let user_input = build
.await
.unwrap;
let = client
.ask_stream_plain
.await
.unwrap;
// For example, stop the client from answering after four answers
let mut times = 0;
while let Yielded = stream.async_resume.await
Draw images
let imgs = client.draw_image.await.unwrap;