chore: release v0.5.0

This commit is contained in:
sigoden 2023-03-08 21:35:21 +08:00
parent 9d32837669
commit 7270308a24
3 changed files with 151 additions and 60 deletions

94
Cargo.lock generated
View File

@ -10,7 +10,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "aichat"
version = "0.4.0"
version = "0.5.0"
dependencies = [
"anyhow",
"atty",
@ -181,6 +181,16 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "core-foundation"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.3"
@ -328,7 +338,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbcf33c2a618cbe41ee43ae6e9f2e48368cd9f9db2896f10167d8d762679f639"
dependencies = [
"nix",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -456,7 +466,7 @@ checksum = "8ef1a30ae415c3a691a4f41afddc2dbcd6d70baf338368d85ebc1e8ed92cedb9"
dependencies = [
"cfg-if",
"rustix",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -749,7 +759,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
dependencies = [
"libc",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -767,7 +777,7 @@ dependencies = [
"hermit-abi 0.3.1",
"io-lifetimes",
"rustix",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -885,7 +895,7 @@ dependencies = [
"libc",
"log",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -986,6 +996,12 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "openssl-probe"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "os_str_bytes"
version = "6.4.1"
@ -1018,7 +1034,7 @@ dependencies = [
"libc",
"redox_syscall",
"smallvec",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -1157,6 +1173,7 @@ dependencies = [
"percent-encoding",
"pin-project-lite",
"rustls",
"rustls-native-certs",
"rustls-pemfile",
"serde",
"serde_json",
@ -1201,7 +1218,7 @@ dependencies = [
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -1216,6 +1233,18 @@ dependencies = [
"webpki",
]
[[package]]
name = "rustls-native-certs"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50"
dependencies = [
"openssl-probe",
"rustls-pemfile",
"schannel",
"security-framework",
]
[[package]]
name = "rustls-pemfile"
version = "1.0.2"
@ -1246,6 +1275,15 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "schannel"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3"
dependencies = [
"windows-sys 0.42.0",
]
[[package]]
name = "scopeguard"
version = "1.1.0"
@ -1268,6 +1306,29 @@ dependencies = [
"untrusted",
]
[[package]]
name = "security-framework"
version = "2.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254"
dependencies = [
"bitflags",
"core-foundation",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "serde"
version = "1.0.152"
@ -1529,7 +1590,7 @@ dependencies = [
"signal-hook-registry",
"socket2",
"tokio-macros",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -1873,6 +1934,21 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows-sys"
version = "0.45.0"

View File

@ -1,6 +1,6 @@
[package]
name = "aichat"
version = "0.4.0"
version = "0.5.0"
edition = "2021"
authors = ["sigoden <sigoden@gmail.com>"]
description = "A powerful chatgpt cli."
@ -20,7 +20,6 @@ futures-util = "0.3.26"
inquire = "0.5.3"
is-terminal = "0.4.4"
reedline = "0.16.0"
reqwest = { version = "0.11.14", features = ["json", "stream", "socks", "rustls-tls"], default-features = false}
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"
serde_yaml = "0.9.17"
@ -33,6 +32,11 @@ unicode-width = "0.1.10"
bincode = "1.3.3"
ctrlc = "3.2.5"
[dependencies.reqwest]
version = "0.11.14"
features = ["json", "stream", "socks", "rustls-tls", "rustls-tls-native-roots"]
default-features = false
[dependencies.syntect]
version = "5.0.0"
default-features = false

109
README.md
View File

@ -5,8 +5,7 @@
A powerful ChatGPT command line tool that allows easy chat with ChatGPT-3.5 in a terminal.
![demo](https://user-images.githubusercontent.com/4012553/223005945-3450cbde-b383-434b-9049-d61877f76a4f.gif)
![demo](https://user-images.githubusercontent.com/4012553/223645914-f397b95f-1a30-4eda-a6a8-5bd0c2903add.gif)
## Install
@ -25,9 +24,9 @@ Download from [Github Releases](https://github.com/sigoden/aichat/releases), unz
- Predefine AI [roles](#roles)
- Use GPT prompt easily
- Powerful [Chat REPL](#chat-repl)
- Markdown highlight
- Stream output
- Multiline input
- syntax highlighting markdown and other 200 languages.
- Stream output with hand typing effect
- Multiline input support and emacs-like editing experience
- Proxy support
- Save chat messages
@ -69,6 +68,7 @@ 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 write explanations.
# temperature: 0.3
```
Let ChatGPT answer questions in the role of a linux shell expert.
@ -76,11 +76,11 @@ Let ChatGPT answer questions in the role of a linux shell expert.
```
〉.role shell
resize app.png to 256x256
convert app.png -resize 256x256 app.png
〉 extract password protected app.zip to /tmp/app
unzip -P password app.zip -d /tmp/app
extract encrypted zipfile app.zip to /tmp/app
```
```bash
mkdir /tmp/app
unzip -P PASSWORD app.zip -d /tmp/app
```
## CLI
@ -95,34 +95,40 @@ Arguments:
Options:
-H, --no-highlight Turn off highlight
-L, --list-roles List all roles
-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 calculate 25.6 + 32.5
aichat math 3.8x4
```
control highlighting and streaming
```sh
aichat -r shell flip the image horizontally
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.4.0
Welcome to aichat 0.5.0
Type ".help" for more information.
```
aichat can accept pipe.
```sh
# convert toml to json
cat Cargo.toml | aichat -H turn toml below to json
```
## Chat REPL
aichat has a powerful Chat REPL.
@ -132,33 +138,30 @@ Tle Chat REPL supports:
- command autocompletion
- history search
- fish-style history autosuggestion hints
- mulitline input
- edit/past multiline input
- undo support
- clipboard integration
Chat REPL also provide many commands.
```
Welcome to aichat 0.4.0
Welcome to aichat 0.5.0
Type ".help" for more information.
〉.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
.prompt Add prompt, aka create a temporary role
.history Print the history
.clear history Clear the history
.clear screen Clear the screen
.multiline Enter multiline editor mode
.copy Copy last reply message
.editor Enter editor mode for multiline input
.help Print this help message
.exit Exit the REPL
Press Ctrl+C to abort session, Ctrl+D to exit the REPL
```
- View current configuration information.
### `.info` - view current configuration information.
```
〉.info
@ -174,8 +177,7 @@ proxy -
dry_run false
```
- Modify the configuration temporarily
### `.set` - modify the configuration temporarily
```
〉.set highlight false
@ -183,21 +185,7 @@ dry_run false
〉.set temperature 1.2
```
- Input multiline text
```
〉.multiline {convert json below to toml
::: {
::: "an": [
::: "arbitrarily",
::: "nested"
::: ],
::: "data": "structure"
::: }
::: }
```
- Use GPT Prompt
### `.prompt` - use GPT prompt
When you set up a prompt, every message sent later will carry the prompt.
@ -216,16 +204,39 @@ Done
🙈😳
```
`.prompt` actually creates a temporary role called `%TEMP%` internally, so you run `.clear role` to clear the prompt.
`.prompt` actually creates a temporary role called `%TEMP%` internally, so **run `.clear role` to clear the prompt**.
When you are satisfied with the prompt, add it to `roles.yaml` for later use.
- Copy last reply message
### `.role` - let the ai play a role
The message may be highlighted, and when copied, you will find that they are different from the original Markdown text.
Select a role.
```
〉.role shell
```
At this point you need to use `.copy` to copy the original text to the clipboard.
Unselect a role.
```
〉.clear role
```
Use `.info` to check current selected role.
### `.editor` - input/paste multiline text
Type `.editor {` to enter editor mode, you can input/paste multiline text, quite editor mode with `}`
```
〉.editor {convert json below to toml
::: {
::: "an": [
::: "arbitrarily",
::: "nested"
::: ],
::: "data": "structure"
::: }
::: }
```
## License