Metadata-Version: 2.1
Name: cli-chat
Version: 0.1.1
Summary: 
License: GPLv3
Author: Zhu Zhaomeng
Author-email: zhaomeng.zhu@ntu.edu.sg
Requires-Python: >=3.11,<4.0
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: openai (>=0.27.0,<0.28.0)
Requires-Dist: prompt-toolkit (>=3.0.38,<4.0.0)
Requires-Dist: rich (>=13.3.1,<14.0.0)
Description-Content-Type: text/markdown

# cli-chat

`cli-chat` is a powerful command-line tool that allows you to have a conversation with ChatGPT from your terminal. Follow the simple steps below to install and use this tool.

## Installation

You can easily install `cli-chat` by typing the following command in your terminal:

```bash
pip install cli-chat
```

Alternatively, you can clone the repository and install the dependencies using `poetry`. Follow the steps below:

1. Clone the repository.
2. Run `poetry install`.

## Usage

To start a conversation, simply type the following command in your terminal:

```bash
cli-chat
```

Alternatively, start the script using `poetry` by typing the following command in your terminal:

```bash
poetry run cli-chat
```

Here are a few things to keep in mind when using `cli-chat`:

* Before using the tool, you must obtain an API key from [here](https://platform.openai.com/account/api-keys).
* The API key will be saved in a file named `.key` in your current directory. To change the key or stop using the tool, simply delete this file.
* You can use arrow keys to navigate through your conversation history.
* To end the conversation, type "thanks", "thx", or a similar phrase.
* Common key-bindings and auto-suggestions are supported, thanks to [prompt_toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit).

### Control Sequences

You can use special control sequences to modify the behavior of the tool. A sequence is always placed at the beginning of your question string and starts with a backslash `\`.

The following control sequences are available:

| Sequence     | Description                                                                                        |
|--------------|----------------------------------------------------------------------------------------------------|
| `\no-render` | Do not render the answer's markdown.                                                               |
| `\load-file` | Load a file and use its contents as the next question.                                             |
| `\long`      | Accept multi-line inputs starting from now on.                                                     |
| `\save`      | Save the last answer in a file.                                                                    |
| `\hide-answer`| Do not show the answer. **Danger: If you want to save the answer later, always check it.**" |

You can use multiple control sequences at once by separating them with commas. For example, `\no-render,load-file` will load a file and not render its contents as markdown.

## Example

Here are a couple of examples of what a conversation with `cli-chat` might look like:

![Example 1](./docs/example-1.png)

![Example 2](./docs/example-2.png)

![Example 3](./docs/example-3.png)
