BingGPT command line client, written in rust.

Overview
BingGPT

BingGPT

BingGPT command line client, written in rust


中文说明

This project is a rust language implementation of EdgeGPT, all the hard stuff was done by the original project author acheong08, I just wrote it in rust, all credit goes to him, thanks for the hard work big guy!

Install

cargo install binggpt-cli
# use `binggpt` 
binggpt

Or download the binary from the release page.

Requirements

You must have a Microsoft account with access to BingGPT.

Configuration (required)

  • for Chrome or Firefox to install the cookie-editor extension
  • Go to bing.com and log in to your Microsoft account
  • Open the extension
  • Click "Export" in the bottom right corner (this will save your cookies to the clipboard)
  • Create or write your cookies to the ~/.config/bing-cookies.json file

Usage

First you need to perform the configuration steps above.

If you have a rust development environment, first you need to clone the code, go to this project directory, and run cargo run.

If you want to compile it into binaries, you can run cargo build --release. After the compilation is done, you can find the compiled binaries in the target/release directory.

If you want to install it to the system, you can run cargo install --path binggpt-cli, so you can easily use the binggpt command anywhere.

After starting the program, when you see You:, it means you can start a conversation with BingGPT, press enter twice to send a message.

In the conversation, you can use the following command.

  • :q :quit :exit to quit the program
  • :more to enter multi-line mode, where you can safely type more text, or paste text from the clipboard
  • :end exit multi-line mode

Possible problems

For Windows10 users

see #3

Ensure that users running Windows 10 use this command in their terminal, with administrator privileges, to enable text colors in the terminal.

reg add HKCU\Console /v VirtualTerminalLevel /t REG_DWORD /d 1

As a rust crate

cargo add binggpt
cargo add utf8-slice
cargo add tokio --features full
use std::io::{stdout, Write};

#[tokio::main]
async fn main() {
    let mut bing = binggpt::Bing::new("~/.config/bing-cookies.json")
        .await
        .unwrap();

    // send message
    bing.send_msg("hello").await.unwrap();

    // receive message
    let mut index = 0;

    // loop until the chat is done
    loop {
        if bing.is_done() {
            break;
        }

        let Some(answer) = bing.recv_text().await.unwrap() else{
            continue;
        };

        // print the new part of the answer
        if !answer.is_empty() {
            print!("{}", utf8_slice::from(&answer, index));
            if stdout().flush().is_err() {
                println!("Warning: Failed to flush stdout");
            };
            index = utf8_slice::len(&answer);
        }
    }
}

Contributors

This project exists thanks to all the people who contribute.

License

MIT

You might also like...
Command line tool for cheap and efficient email automation written in Rust

Pigeon Pigeon is a command line tool for automating your email workflow in a cheap and efficient way. Utilize your most efficient dev tools you are al

A silly program written in Rust to output nonsensical sentences in the command line interface.

A silly program written in Rust to output nonsensical sentences in the command line interface.

A simplified recreation of the command-line utility grep written in Rust.

smolgrep A simplified recreation of the command-line utility grep written in Rust. Download and run Download Rust On Mac/Linux Open a terminal and ent

Xsv - A fast CSV command line toolkit written in Rust.

xsv is a command line program for indexing, slicing, analyzing, splitting and joining CSV files. Commands should be simple, fast and composable: Simpl

Wordlet - a command line clone of Wordle, written in Rust.
Wordlet - a command line clone of Wordle, written in Rust.

Wordlet Wordlet is a command line clone of Wordle, written in Rust. Installation $ cargo install wordlet Usage After installation, start Wordlet by ty

This is a simple command line application to convert bibtex to json written in Rust and Python

bibtex-to-json This is a simple command line application to convert bibtex to json written in Rust and Python. Why? To enable you to convert very big

A standalone Command Line Interface debugging tool for The Witcher 3 written in Rust
A standalone Command Line Interface debugging tool for The Witcher 3 written in Rust

A standalone Command Line Interface debugging tool for The Witcher 3 written in Rust. This tool is intended for Witcher 3 modders who make mainly scri

A command line tool, manage your hundreds of repository, written with Rust

A command line tool, manage your hundreds of repository, written with Rust

A blazing fast command line license generator for your open source projects written in Rust🚀
A blazing fast command line license generator for your open source projects written in Rust🚀

Overview This is a blazing fast ⚡ , command line license generator for your open source projects written in Rust. I know that GitHub

Comments
Owner
null
Command-line HTTP client for sending a POST request to specified URI on each stdin line.

line2httppost Simple tool to read lines from stdin and post each line as separate POST request to a specified URL (TCP connection is reused though). G

Vitaly Shukela 3 Jan 3, 2023
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

William D. Jones 5 Aug 20, 2022
REC2 (Rusty External Command and Control) is client and server tool allowing auditor to execute command from VirusTotal and Mastodon APIs written in Rust. 🦀

Information: REC2 is an old personal project (early 2023) that I didn't continue development on. It's part of a list of projects that helped me to lea

Quentin Texier (g0h4n) 104 Oct 7, 2023
nhdl - a command-line doujinshi downloader client built in rust!

nhdl nhdl - a command-line doujinshi downloader client built in rust! goals fast and asynchronous doujinshi downloader, supporting various doujinshi s

Lumine 2 Dec 23, 2022
Another HackerNews command-line client

Another HackerNews command-line client

Sébastien Castiel 22 Dec 12, 2021
dog is a command-line DNS client, like dig

dog dog is a command-line DNS client. Dogs can look up! dog is a command-line DNS client, like dig. It has colourful output, understands normal comman

Benjamin Sago 4.8k Jan 8, 2023
Non-interactive nREPL client for shell scripts and command-line

nreplops-tool (nr) nreplops-tool (nr) is a non-interactive nREPL client designed to be used in shell scripts and on the command-line. Early α warning:

Matti Hänninen 3 Jul 1, 2022
Pink is a command-line tool inspired by the Unix man command.

Pink is a command-line tool inspired by the Unix man command. It displays custom-formatted text pages in the terminal using a subset of HTML-like tags.

null 3 Nov 2, 2023
⚡️ Lightning-fast and minimal calendar command line. Written in Rust 🦀

⚡️ Lightning-fast and minimal calendar command line. It's similar to cal. Written in Rust ??

Arthur Henrique 36 Jan 1, 2023
A small command-line application to view images from the terminal written in Rust.

A small command-line application to view images from the terminal written in Rust. It is basically the front-end of viuer

Atanas Yankov 1.9k Jan 3, 2023