Crates.io | bard-rs |
lib.rs | bard-rs |
version | 1.2.7 |
source | src |
created_at | 2023-04-28 06:21:38.343919 |
updated_at | 2024-07-25 08:09:06.455559 |
description | Google Gemini CLI (Bard) |
homepage | |
repository | https://github.com/Alfex4936/Bard-rs |
max_upload_size | |
id | 851176 |
size | 1,671,041 |
A simple command line interface for interacting with Google Gemini (Previously Bard
), written in Rust.
This CLI allows you to save chat history as a Markdown file at a specified absolute or relative path in realtime
and handles graceful exit with Ctrl+C.
You need to have Rust and Cargo installed on your system. If you don't have them, you can install them from the official Rust website.
Install from cargo. Add -f
at the end to force update. (cargo install bard-rs -f
)
cargo install bard-rs
or
Clone the repository to your local machine:
git clone https://github.com/Alfex4936/Bard-rs
Change the working directory:
cd Bard-rs
Build the project:
cargo build --release
The executable binary file will be located in the target/release
folder.
Before using the Google Gemini CLI, you need to obtain your session cookie. To get the session cookie, follow these steps:
Ctrl + Shift + I
).__Secure-1PSID
(Must) and __Secure-1PSIDTS
(Optional), and copy the values.Now you can use the Google Gemini CLI:
Supported options:
-s
(__Secure-1PSID cookie),-t
(__Secure-1PSIDTS cookie),-m
(if present, it'll print other Gemini's responses for your prompt),-p
(if present with path, it'll save your chat history as markdown.),-e
(if present with .env file location, it'll use that session cookie)
It'll save as your first prompt message. (eg: "Hey yo" -> gemini_hey_yo.md)
bard-rs --psid <your_psid> --psidts <your_psidts> --path ./
bard-rs --psid <your_psid> --path ./
Replace <your_psid>
and <your_psidts>
with the value you copied from the Developer Tools.
If you don't want to save the chat history as a Markdown file, skip --path
:
bard-rs -p <your_psid>
If you don't want to pass that long session in terminal, use .env
file (refer to .env_sample
)
bard-rs -e .env -p ./
If you prefer not to specify a path, bard-rs
will automatically search for the .env file in the following locations: the argument-provided path, the current working directory, and the directory of the bard-rs binary.
(GEMINI_HISTORY
is required in .env
if you want to save the chat history as markdown file everytime.)
bard-rs
above command is same as bard-rs -e .env
.env
file must contain PSID
key. (it is derived from __Secure-1PSID
)
![IMPORTANT] Need
__Secure-1PSID
and__Secure-1PSIDTS
! using
echo PSID=... > .env
might cause encoding problem thatdotenv
cannot read and end up causing no session key error.
PSID=~.
[!IMPORTANT] if you are getting "SNlM0e not found. Check your cookies." even with
__Secure-1PSIDTS
__Secure-1PSID
(Seems like typically contains a numerical identifier representing the logged-in user.)!reset
to reset the conversation.!exit
to exit the CLI.!show
to see other Gemini's answers for your last message.This project is licensed under the MIT License.
Credits: