summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--README.md125
3 files changed, 87 insertions, 42 deletions
diff --git a/Cargo.lock b/Cargo.lock
index e1c4306..b5de47e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -19,7 +19,7 @@ dependencies = [
[[package]]
name = "aichat"
-version = "0.5.0"
+version = "0.6.0"
dependencies = [
"anyhow",
"atty",
diff --git a/Cargo.toml b/Cargo.toml
index 093a698..a40a16d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "aichat"
-version = "0.5.0"
+version = "0.6.0"
edition = "2021"
authors = ["sigoden <sigoden@gmail.com>"]
description = "A powerful chatgpt cli."
diff --git a/README.md b/README.md
index f8d1096..a7192b1 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,7 @@ Download from [Github Releases](https://github.com/sigoden/aichat/releases), unz
- Predefine AI [roles](#roles)
- Use GPT prompt easily
- Powerful [Chat REPL](#chat-repl)
+- Context-ware conversation
- syntax highlighting markdown and other 200 languages.
- Stream output with hand typing effect
- Multiline input support and emacs-like editing experience
@@ -50,6 +51,7 @@ temperature: 1.0 # optional, see https://platform.openai.com/do
save: true # optional, If set to 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 ture, start a conversation immediately upon repl
```
> You can specify the configuration directory through `$AICHAT_CONFIG_DIR`
@@ -74,15 +76,14 @@ For example, we define a role.
```
Let ChatGPT answer questions in the role of a linux shell expert.
-
```
〉.role shell
-〉 extract encrypted zipfile app.zip to /tmp/app
-```
-```bash
+shell〉 extract encrypted zipfile app.zip to /tmp/app
+---
mkdir /tmp/app
unzip -P PASSWORD app.zip -d /tmp/app
+---
```
## CLI
@@ -144,23 +145,40 @@ Tle Chat REPL supports:
- undo support
- clipboard integration
-Chat REPL also provide many commands.
+### multi-line editing mode
+
+**Type `{` or `(` 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 `}`, `)` `]` at the end of the line to exit the mode and submit the content.
```
-Welcome to aichat 0.5.0
-Type ".help" for more information.
-.info Print the information
-.set Modify the configuration temporarily
-.prompt Add a GPT prompt
-.role Select a role
-.clear role Clear the currently selected role
-.history Print the history
-.clear history Clear the history
-.editor Enter editor mode for multiline input
-.help Print this help message
-.exit Exit the REPL
+〉{ convert json below to toml
+{
+ "an": [
+ "arbitrarily",
+ "nested"
+ ],
+ "data": "structure"
+}}
+```
+
+
+### `.help` - Print help message
+
+```
+〉.help
+.info Print the information
+.set Modify the configuration temporarily
+.prompt Add a GPT prompt
+.role Select a role
+.clear role Clear the currently selected role
+.conversation Start a conversation.
+.clear conversation End current conversation.
+.history Print the history
+.clear history Clear the history
+.help Print this help message
+.exit Exit the REPL
+
+Press Ctrl+C to abort conversation, Ctrl+D to exit the REPL
-Press Ctrl+C to abort session, Ctrl+D to exit the REPL
```
### `.info` - view current configuration information.
@@ -176,6 +194,7 @@ temperature -
save true
highlight true
proxy -
+conversation_first false
dry_run false
```
@@ -192,17 +211,17 @@ dry_run false
When you set up a prompt, every message sent later will carry the prompt.
```
-〉.prompt {
-::: I want you to translate the sentences I wrote into emojis.
-::: I will write the sentence, and you will express it with emojis.
-::: I don't want you to reply with anything but emoji.
-::: }
+〉{ .prompt
+I want you to translate the sentences I wrote into emojis.
+I will write the sentence, and you will express it with emojis.
+I don't want you to reply with anything but emoji.
+}
Done
-〉You are a genius
+P〉You are a genius
👉🧠💡👨‍🎓
-〉I'm embarrassed
+P〉I'm embarrassed
🙈😳
```
@@ -213,33 +232,59 @@ When you are satisfied with the prompt, add it to `roles.yaml` for later use.
### `.role` - let the ai play a role
Select a role.
+
```
-〉.role shell
+〉.role emoji
+name: emoji
+prompt: I want you to translate the sentences I wrote into emojis. I will write the sentence, and you will express it with emojis. I just want you to express it with emojis. I don't want you to reply with anything but emoji. When I need to tell you something in English, I will do it by wrapping it in curly brackets like {like this}.
+temperature: null
+```
+
+AI play the role we specified
+```
+emoji〉hello
+👋
```
-Unselect a role.
+Clear current selected role
```
-〉.clear role
+emoji〉.clear role
+
+〉hello
+Hello there! How can I assist you today?
```
-Use `.info` to check current selected role.
+### `.conversation` - start a context-aware conversation
-### `.editor` - input/paste multiline text
+By default, aichat behaves in a one-off request/response manner.
-Type `.editor {` to enter editor mode, you can input/paste multiline text, quite editor mode with `}`
+You can run `.conversation` to enter context-aware mode, or set `config.conversation_first` true to start a conversation immediately upon repl.
```
-〉.editor {convert json below to toml
-::: {
-::: "an": [
-::: "arbitrarily",
-::: "nested"
-::: ],
-::: "data": "structure"
-::: }
-::: }
+〉.conversation
+
+$list 1 to 5, one per line 4089
+1
+2
+3
+4
+5
+
+$reverse the list 4065
+5
+4
+3
+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.
+
## License
Copyright (c) 2023 aichat-developers.