Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 committed May 22, 2023
1 parent ad06541 commit b279125
Showing 1 changed file with 60 additions and 43 deletions.
103 changes: 60 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,72 @@
# Cli for ChatGPT
# CLI for ChatGPT

A TUI for ChatGPT API, powered by GPT-3.5-turbo and GPT-4 models.
A CLI for ChatGPT, powered by GPT-3.5-turbo and GPT-4 models.

![chatgpt-1 0](https://user-images.githubusercontent.com/10510431/229564407-e4c0b6bf-adfb-40f0-a63c-840dafbc1291.gif)
![demo](https://user-images.githubusercontent.com/10510431/229564407-e4c0b6bf-adfb-40f0-a63c-840dafbc1291.gif)

## Usage

Get or create your OpenAI API Key from here: https://platform.openai.com/account/api-keys

```shell
```sh
export OPENAI_API_KEY=xxx
```

:speech_balloon: Start in chat mode

# Chat mode
```sh
chatgpt
```

:speech_balloon: Start in chat mode with a provided prompt

# Create a new chat and provide a prompt
```sh
chatgpt -n -p translator
```

:computer: Use in a pipeline

# One-time chat mode, easily integrate with other tools
```sh
cat config.yaml | chatgpt -p 'convert this yaml to json'
echo "Hello, world" | chatgpt -p translator | say
```

## Installation

You can download the latest binary from the [release page](https://github.com/j178/chatgpt/releases).

### Install via [HomeBrew](https://brew.sh/) on macOS/Linux

```shell
brew install j178/tap/chatgpt
```

### Install via [Scoop](https://scoop.sh/) on Windows

```shell
scoop bucket add j178 https://github.com/j178/scoop-bucket.git
scoop install j178/chatgpt
```

### Install via [Nix](https://search.nixos.org/packages) on macOS/Linux

```
environment.systemPackages = [
pkgs.chatgpt-cli
];
```

### Install via go

```shell
go install github.com/j178/chatgpt/cmd@latest
```

## Keybings

<details>
<summary>Click to expand</summary>

### General Key Bindings

| Key Combination | Description |
Expand Down Expand Up @@ -81,39 +126,14 @@ echo "Hello, world" | chatgpt -p translator | say
| `ctrl+d` | Submit text when in multi-line mode |
| `enter` | Insert a new line when in multi-line mode |

</details>

## Installation

You can download the latest binary from the [release page](https://github.com/j178/chatgpt/releases).
## Advanced usage

### Install via go
<details>
<summary>Click to expand </summary>

```shell
go install github.com/j178/chatgpt/cmd@latest
```

### Install via [HomeBrew](https://brew.sh/) on macOS/Linux

```shell
brew install j178/tap/chatgpt
```

### Install via [Nix](https://search.nixos.org/packages) on macOS/Linux

```
environment.systemPackages = [
pkgs.chatgpt-cli
];
```

### Install via [Scoop](https://scoop.sh/) on Windows

```shell
scoop bucket add j178 https://github.com/j178/scoop-bucket.git
scoop install j178/chatgpt
```

## Configuration
### Configuration

This cli tool reads configuration from `~/.config/chatgpt/config.json` and saves the conversation history to `~/.config/chatgpt/conversations.json`.

Expand Down Expand Up @@ -178,7 +198,7 @@ You can change parameters for each conversation in `~/.config/chatgpt/conversati

You can add more prompts in the config file, for example:

```jsonc
```json
{
"api_key": "sk-xxxxxx",
"endpoint": "https://api.openai.com/v1",
Expand All @@ -198,7 +218,7 @@ You can add more prompts in the config file, for example:

then use `-p` flag to switch prompt:

```shell
```sh
chatgpt -p translator
```

Expand All @@ -219,6 +239,7 @@ If you are using Azure OpenAI service, you should configure like this:
"api_version": "2023-03-15-preview"
}
```
</details>

## Troubleshooting

Expand All @@ -232,7 +253,3 @@ If you are using Azure OpenAI service, you should configure like this:
## License

MIT

## Original Author

Yasuhiro Matsumoto (a.k.a. mattn)

0 comments on commit b279125

Please sign in to comment.