3
3
[ ![ CI] ( https://github.com/sigoden/aichat/actions/workflows/ci.yaml/badge.svg )] ( https://github.com/sigoden/aichat/actions/workflows/ci.yaml )
4
4
[ ![ Crates] ( https://img.shields.io/crates/v/aichat.svg )] ( https://crates.io/crates/aichat )
5
5
6
- Chat with gpt -3.5/chatgpt in terminal.
6
+ Using ChatGPT/GPT -3.5/GPT-4 in the terminal.
7
7
8
- ![ demo] ( https://user-images.githubusercontent.com/4012553/223645914-f397b95f-1a30-4eda-a6a8-5bd0c2903add.gif )
8
+ AIChat in chat mode:
9
+
10
+ ![ chat mode] ( https://user-images.githubusercontent.com/4012553/226499667-4c6b261a-d897-41c7-956b-979b69da5982.gif )
11
+
12
+ AIChat in command mode:
13
+
14
+ ![ command mode] ( https://user-images.githubusercontent.com/4012553/226499595-0b536c82-b039-4571-a077-0c40ad57f7db.png )
9
15
10
16
## Install
11
17
@@ -21,13 +27,14 @@ Download it from [Github Releases](https://github.com/sigoden/aichat/releases),
21
27
22
28
## Features
23
29
30
+ - Support chat and command modes
24
31
- Predefine AI [ roles] ( #roles )
25
32
- Use GPT prompt easily
26
33
- Powerful [ Chat REPL] ( #chat-repl )
27
34
- Context-ware conversation
28
- - syntax highlighting markdown and other 200 languages.
35
+ - syntax highlighting markdown and other 200 languages
29
36
- Stream output with hand typing effect
30
- - Multiline input support and emacs-like editing experience
37
+ - Support multiple models
31
38
- Support proxy
32
39
- Support dark/light theme
33
40
- Save chat messages
@@ -48,12 +55,15 @@ After setting, it will automatically create the configuration file. Of course, y
48
55
49
56
``` yaml
50
57
api_key : " <YOUR SECRET API KEY>" # Request via https://platform.openai.com/account/api-keys
58
+ organization_id : " org-xxx" # optional, set organization id
59
+ model : " gpt-3.5-turbo" # optional, choose a model
51
60
temperature : 1.0 # optional, see https://platform.openai.com/docs/api-reference/chat/create#chat/create-temperature
52
61
save : true # optional, If set true, aichat will save chat messages to message.md
53
62
highlight : true # optional, Set false to turn highlight
54
63
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
55
64
conversation_first : false # optional, If set true, start a conversation immediately upon repl
56
65
light_theme : false # optional, If set true, use light theme
66
+ connect_timeout : 10 # optional, Set a timeout in seconds for connect to gpt.
57
67
` ` `
58
68
59
69
> 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
66
76
67
77
We can predefine a batch of roles in `roles.yaml`.
68
78
69
- > We can get the location of `roles.yaml` through the `.info` command.
79
+ > We can get the location of `roles.yaml` through the repl's `.info` command or cli's `--info` option .
70
80
71
81
For example, we define a role
72
82
@@ -76,68 +86,18 @@ For example, we define a role
76
86
I want you to act as a linux shell expert.
77
87
I want you to answer only with bash code.
78
88
Do not provide explanations.
79
- # temperature: 0.3
80
89
` ` `
81
90
82
91
Let ChatGPT answer questions in the role of a linux shell expert.
83
92
```
84
93
〉.role shell
85
94
86
95
shell〉 extract encrypted zipfile app.zip to /tmp/app
87
- ---
88
96
mkdir /tmp/app
89
97
unzip -P PASSWORD app.zip -d /tmp/app
90
- ---
91
- ```
92
-
93
- We have provided many [Role Examples](https://github.com/sigoden/aichat/wiki/Role-Examples).
94
-
95
- ## CLI
96
-
97
- ```
98
- A powerful chatgpt cli.
99
-
100
- Usage: aichat [ OPTIONS] [ TEXT] ...
101
-
102
- Arguments:
103
- [ TEXT] ... Input text
104
-
105
- Options:
106
- -p, --prompt <PROMPT > Set a GPT prompt
107
- -H, --no-highlight Disable syntax highlightiing
108
- -S, --no-stream No stream output
109
- --list-roles List all roles
110
- -r, --role <ROLE > Select a role
111
- -h, --help Print help
112
- -V, --version Print version
113
- ```
114
- ### Command mode
115
-
116
- ```sh
117
- aichat math 3.8x4
118
- ```
119
-
120
- control highlighting and streaming
121
-
122
- ``` sh
123
- aichat how to post a json in rust # highlight, streaming output
124
- aichat -H -S how to post a json in rust # no highlight, output all at once
125
- ```
126
-
127
- pipe input/output
128
- ``` sh
129
- # convert toml to json
130
- cat data.toml | aichat turn toml below to json > data.json
131
98
```
132
- ### Chat mode
133
99
134
- Enter Chat REPL if no text input.
135
- ```
136
- $ aichat
137
- Welcome to aichat 0.5.0
138
- Type ".help" for more information.
139
- 〉
140
- ```
100
+ We have provided many awesome [Role Examples](https://github.com/sigoden/aichat/wiki/Role-Examples).
141
101
142
102
## Chat REPL
143
103
@@ -152,7 +112,7 @@ The Chat REPL supports:
152
112
- Undo support
153
113
- Clipboard integration
154
114
155
- ### multi-line editing mode
115
+ ### multi-line editing
156
116
157
117
**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.
158
118
@@ -174,6 +134,7 @@ The Chat REPL supports:
174
134
〉.help
175
135
.info Print the information
176
136
.set Modify the configuration temporarily
137
+ .model Choose a model
177
138
.prompt Add a GPT prompt
178
139
.role Select a role
179
140
.clear role Clear the currently selected role
@@ -186,7 +147,6 @@ The Chat REPL supports:
186
147
187
148
Type ` { ` to enter the multi-line editing mode, type '}' to exit the mode.
188
149
Press Ctrl+C to abort readline, Ctrl+D to exit the REPL
189
-
190
150
```
191
151
192
152
### `.info` - view current configuration information.
@@ -197,23 +157,35 @@ config_file /home/alice/.config/aichat/config.yaml
197
157
roles_file /home/alice/.config/aichat/roles.yaml
198
158
messages_file /home/alice/.config/aichat/messages.md
199
159
api_key sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
160
+ organization_id -
161
+ model gpt-3.5-turbo
200
162
temperature -
201
163
save true
202
164
highlight true
203
165
proxy -
204
166
conversation_first false
205
167
light_theme false
168
+ connect_timeout 10
206
169
dry_run false
207
170
```
208
171
209
172
### `.set` - modify the configuration temporarily
210
173
211
174
```
175
+ 〉.set dry_run true
212
176
〉.set highlight false
213
177
〉.set save false
214
178
〉.set temperature 1.2
215
179
```
216
180
181
+ ### `.model` - choose a model
182
+
183
+ ```
184
+ > .model gpt-4
185
+ > .model gpt-4-32k
186
+ > .model gpt-3.5-turbo
187
+ ```
188
+
217
189
### `.prompt` - use GPT prompt
218
190
219
191
When you set up a prompt, every message sent later will carry the prompt.
234
206
🙈😳
235
207
```
236
208
237
- ` .prompt ` actually creates a temporary role called ` %TEMP% ` internally, so ** run ` .clear role ` to clear the prompt** .
209
+ `.prompt` actually creates a temporary role internally, so **run `.clear role` to clear the prompt**.
238
210
239
211
When you are satisfied with the prompt, add it to `roles.yaml` for later use.
240
212
@@ -286,14 +258,19 @@ You can run `.conversation` to enter context-aware mode, or set `config.conversa
286
258
2
287
259
1
288
260
289
- $.clear conversation 4043
290
-
291
- 〉
292
261
```
293
262
294
263
When enter conversation mode, prompt `〉` will change to `$`, A number will appear on the right, which means how many tokens left to use.
295
264
Once the number becomes zero, you need to start a new conversation.
296
265
266
+ Exit conversation mode
267
+
268
+ ```
269
+ $.clear conversation 4043
270
+
271
+ 〉
272
+ ```
273
+
297
274
## License
298
275
299
276
Copyright (c) 2023 aichat-developers.
0 commit comments