Skip to content

Rust ChatGPT CLI is a user-friendly terminal interface for OpenAI's GPT chatbot. Start conversations, manage ongoing chats, and send text from files to the chatbot with simple commands. Seamlessly integrate GPT-based AI into your command-line workflow.

License

Notifications You must be signed in to change notification settings

DieHard073055/rust-chatgpt-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust ChatGPT CLI

wakatime

In use

rust-chatgpt-cli

rust-chatgpt-cli is a command-line interface (CLI) application that allows you to interact with OpenAI's ChatGPT API. You can start new conversations, list and delete existing ones, and process chatbot prompts.

Usage Instructions

Prerequisites

  • Rust installed on your system
  • OpenAI API Key

Getting Started

Build and Run

  1. Clone this repository:
git clone https://github.com/yourusername/rust-chatgpt-cli.git
  1. Set your OpenAI API key as an environment variable:
export OPENAI_KEY=your_openai_key
  1. Navigate to the project directory:
cd rust-chatgpt-cli
  1. Build the project:
cargo build --release
  1. Run the application:
./target/release/rust-chatgpt-cli [FLAGS] [OPTIONS]

Flags and Options

  • -n, --new-conversation: Start a new conversation
  • -l, --list: List all conversations
  • -d, --del INDEX: Delete a conversation by its index
  • prompt: Enter your prompt (can be a single or multiple words)

Examples

All the features with (🚧) are under still under construction.

  1. Start a new conversation (🚧):
./target/release/rust-chatgpt-cli -n What is the meaning of life?
  1. List all conversations (🚧):
./target/release/rust-chatgpt-cli -l
  1. Delete a conversation by index (🚧):
./target/release/rust-chatgpt-cli -d 2
  1. Provide a prompt:
./target/release/rust-chatgpt-cli Tell me a joke.
  1. Use stdin for the prompt:
echo "What is your favorite color?" | ./target/release/rust-chatgpt-cli
  1. Use a file to build your prompt, then pipe it to chatgpt.
$ cat > prompt
You are a computer science lecturer at a university.
You excel at explaining programming concepts to student.

Could you please explain what a hashtable is?
^C
$ cat prompt | ./target/release/rust-chatgpt-cli

Note: (🚧) You can combine the -n flag with a prompt to start a new conversation with the given prompt.

Contributing

Please feel free to open an issue or submit a pull request with your contributions.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Rust ChatGPT CLI is a user-friendly terminal interface for OpenAI's GPT chatbot. Start conversations, manage ongoing chats, and send text from files to the chatbot with simple commands. Seamlessly integrate GPT-based AI into your command-line workflow.

Topics

Resources

License

Stars

Watchers

Forks