summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--README.md101
3 files changed, 41 insertions, 64 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 4cdd36c..4e050c8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -19,7 +19,7 @@ dependencies = [
[[package]]
name = "aichat"
-version = "0.7.0"
+version = "0.8.0"
dependencies = [
"anyhow",
"atty",
diff --git a/Cargo.toml b/Cargo.toml
index ab15c81..b3a4b73 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "aichat"
-version = "0.7.0"
+version = "0.8.0"
edition = "2021"
authors = ["sigoden <sigoden@gmail.com>"]
description = "A powerful chatgpt cli."
diff --git a/README.md b/README.md
index 0945430..8c52a48 100644
--- a/README.md
+++ b/README.md
@@ -3,9 +3,15 @@
[![CI](https://github.com/sigoden/aichat/actions/workflows/ci.yaml/badge.svg)](https://github.com/sigoden/aichat/actions/workflows/ci.yaml)
[![Crates](https://img.shields.io/crates/v/aichat.svg)](https://crates.io/crates/aichat)
-Chat with gpt-3.5/chatgpt in terminal.
+Using ChatGPT/GPT-3.5/GPT-4 in the terminal.
-![demo](https://user-images.githubusercontent.com/4012553/223645914-f397b95f-1a30-4eda-a6a8-5bd0c2903add.gif)
+AIChat in chat mode:
+
+![chat mode](https://user-images.githubusercontent.com/4012553/226499667-4c6b261a-d897-41c7-956b-979b69da5982.gif)
+
+AIChat in command mode:
+
+![command mode](https://user-images.githubusercontent.com/4012553/226499595-0b536c82-b039-4571-a077-0c40ad57f7db.png)
## Install
@@ -21,13 +27,14 @@ Download it from [Github Releases](https://github.com/sigoden/aichat/releases),
## Features
+- Support chat and command modes
- Predefine AI [roles](#roles)
- Use GPT prompt easily
- Powerful [Chat REPL](#chat-repl)
- Context-ware conversation
-- syntax highlighting markdown and other 200 languages.
+- syntax highlighting markdown and other 200 languages
- Stream output with hand typing effect
-- Multiline input support and emacs-like editing experience
+- Support multiple models
- Support proxy
- Support dark/light theme
- Save chat messages
@@ -48,12 +55,15 @@ After setting, it will automatically create the configuration file. Of course, y
```yaml
api_key: "<YOUR SECRET API KEY>" # Request via https://platform.openai.com/account/api-keys
+organization_id: "org-xxx" # optional, set organization id
+model: "gpt-3.5-turbo" # optional, choose a model
temperature: 1.0 # optional, see https://platform.openai.com/docs/api-reference/chat/create#chat/create-temperature
save: true # optional, If set true, aichat will save chat messages to message.md
highlight: true # optional, Set false to turn highlight
proxy: "socks5://127.0.0.1:1080" # optional, set proxy server. e.g. http://127.0.0.1:8080 or socks5://127.0.0.1:1080
conversation_first: false # optional, If set true, start a conversation immediately upon repl
light_theme: false # optional, If set true, use light theme
+connect_timeout: 10 # optional, Set a timeout in seconds for connect to gpt.
```
> You can use `.info` to view the current configuration file path and roles file path.
@@ -66,7 +76,7 @@ We can let ChatGPT play a certain role through `prompt` to make it better genera
We can predefine a batch of roles in `roles.yaml`.
-> We can get the location of `roles.yaml` through the `.info` command.
+> We can get the location of `roles.yaml` through the repl's `.info` command or cli's `--info` option.
For example, we define a role
@@ -76,7 +86,6 @@ For example, we define a role
I want you to act as a linux shell expert.
I want you to answer only with bash code.
Do not provide explanations.
- # temperature: 0.3
```
Let ChatGPT answer questions in the role of a linux shell expert.
@@ -84,60 +93,11 @@ Let ChatGPT answer questions in the role of a linux shell expert.
〉.role shell
shell〉 extract encrypted zipfile app.zip to /tmp/app
----
mkdir /tmp/app
unzip -P PASSWORD app.zip -d /tmp/app
----
-```
-
-We have provided many [Role Examples](https://github.com/sigoden/aichat/wiki/Role-Examples).
-
-## CLI
-
-```
-A powerful chatgpt cli.
-
-Usage: aichat [OPTIONS] [TEXT]...
-
-Arguments:
- [TEXT]... Input text
-
-Options:
- -p, --prompt <PROMPT> Set a GPT prompt
- -H, --no-highlight Disable syntax highlightiing
- -S, --no-stream No stream output
- --list-roles List all roles
- -r, --role <ROLE> Select a role
- -h, --help Print help
- -V, --version Print version
-```
-### Command mode
-
-```sh
-aichat math 3.8x4
-```
-
-control highlighting and streaming
-
-```sh
-aichat how to post a json in rust # highlight, streaming output
-aichat -H -S how to post a json in rust # no highlight, output all at once
-```
-
-pipe input/output
-```sh
-# convert toml to json
-cat data.toml | aichat turn toml below to json > data.json
```
-### Chat mode
-Enter Chat REPL if no text input.
-```
-$ aichat
-Welcome to aichat 0.5.0
-Type ".help" for more information.
-〉
-```
+We have provided many awesome [Role Examples](https://github.com/sigoden/aichat/wiki/Role-Examples).
## Chat REPL
@@ -152,7 +112,7 @@ The Chat REPL supports:
- Undo support
- Clipboard integration
-### multi-line editing mode
+### multi-line editing
**Type `{` or `(` at the beginning of the line to enter the multi-line editing mode.** In this mode you can type or paste multiple lines of text. Type the corresponding `}` or `)` at the end of the line to exit the mode and submit the content.
@@ -174,6 +134,7 @@ The Chat REPL supports:
〉.help
.info Print the information
.set Modify the configuration temporarily
+.model Choose a model
.prompt Add a GPT prompt
.role Select a role
.clear role Clear the currently selected role
@@ -186,7 +147,6 @@ The Chat REPL supports:
Type `{` to enter the multi-line editing mode, type '}' to exit the mode.
Press Ctrl+C to abort readline, Ctrl+D to exit the REPL
-
```
### `.info` - view current configuration information.
@@ -197,23 +157,35 @@ config_file /home/alice/.config/aichat/config.yaml
roles_file /home/alice/.config/aichat/roles.yaml
messages_file /home/alice/.config/aichat/messages.md
api_key sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+organization_id -
+model gpt-3.5-turbo
temperature -
save true
highlight true
proxy -
conversation_first false
light_theme false
+connect_timeout 10
dry_run false
```
### `.set` - modify the configuration temporarily
```
+〉.set dry_run true
〉.set highlight false
〉.set save false
〉.set temperature 1.2
```
+### `.model` - choose a model
+
+```
+> .model gpt-4
+> .model gpt-4-32k
+> .model gpt-3.5-turbo
+```
+
### `.prompt` - use GPT prompt
When you set up a prompt, every message sent later will carry the prompt.
@@ -234,7 +206,7 @@ Done
🙈😳
```
-`.prompt` actually creates a temporary role called `%TEMP%` internally, so **run `.clear role` to clear the prompt**.
+`.prompt` actually creates a temporary role internally, so **run `.clear role` to clear the prompt**.
When you are satisfied with the prompt, add it to `roles.yaml` for later use.
@@ -286,14 +258,19 @@ You can run `.conversation` to enter context-aware mode, or set `config.conversa
2
1
-$.clear conversation 4043
-
-〉
```
When enter conversation mode, prompt `〉` will change to `$`, A number will appear on the right, which means how many tokens left to use.
Once the number becomes zero, you need to start a new conversation.
+Exit conversation mode
+
+```
+$.clear conversation 4043
+
+〉
+```
+
## License
Copyright (c) 2023 aichat-developers.