Commit Graph

542 Commits

Author SHA1 Message Date
sigoden
899c4af9ea fix: forbid .clear role in middle of conversation 2023-03-10 07:13:22 +08:00
sigoden
ff00426c2c chore: improve code quality, split rep/prompt.rs from repl/init.rs 2023-03-10 07:08:40 +08:00
sigoden
4161eaa6c3
fix: cli specify role is not applied when conversation_first set true (#57)
close #56
2023-03-10 07:02:44 +08:00
sigoden
0044399509
feat: add config.conversation_first (#55)
If set true, start a conversation immediately upon repl.
2023-03-09 23:30:12 +08:00
sigoden
ad282ae74c refactor: no need to confirm conversation when token used out 2023-03-09 22:53:25 +08:00
sigoden
89eaf1b653 fix: csharp and php do not render correctly 2023-03-09 22:46:33 +08:00
sigoden
553d0fe55b
refactor: optimize counting tokens (#53) 2023-03-09 21:18:28 +08:00
sigoden
9767c07eee
feat: support two types of role prompts (#52)
1. embeded prompt

use __INPUT__ placeholder
will generate one user message when send to gpt
```
- name: shell
  prompt: >
    I want you to act as a linux shell expert.
    Q: How to unzip a file
    A: unzip file.zip
    Q: __INPUT__
    A:
```

2. system prompt
no __INPUT__ placeholder
will generate on system message and one user message when send to gpt
```
- name: shell
  prompt: |
    I want you to act as a linux shell expert.
    I want you to answer only with bash code.
    Do not write explanations.
```
2023-03-09 19:10:02 +08:00
sigoden
c45d71cdea refactor: trivial updates
- change prompt's temp role name
- questionnaire of 'save chat messages' default set true
- `.info` do not show role name
2023-03-09 16:52:04 +08:00
sigoden
05d20f207f
feat: add remain tokens indicator and max tokens guard (#50) 2023-03-09 15:30:39 +08:00
sigoden
c7eb261abc
fix: abort by ctrlc unexpectedly prints error message (#49) 2023-03-09 11:05:42 +08:00
sigoden
a62e461e38
feat: support conversation (#48) 2023-03-09 10:39:28 +08:00
sigoden
a7f2da156c
feat: add role info to readline indicator (#47)
```
coder〉
```
2023-03-09 08:26:35 +08:00
sigoden
e78b5f7c58 refactor: imports order and group 2023-03-09 08:15:14 +08:00
sigoden
1ec451da89
refactor: replace Arc<Refcell<Config>> with Arc<Mutex<Config>> (#46) 2023-03-09 07:58:44 +08:00
sigoden
ebd3cb2401 chore: update readme 2023-03-09 07:04:12 +08:00
sigoden
00ba8b5108 refactor: extra spaces are allowed around repl command 2023-03-09 07:02:28 +08:00
sigoden
ed905e3bd1 chore: fix cargo keyword 2023-03-08 21:56:24 +08:00
sigoden
7270308a24 chore: release v0.5.0 2023-03-08 21:35:21 +08:00
sigoden
9d32837669
chore: optimize newline again (#43)
* chore: optimize newline again

command mode: should no extra newline
chat mode: should have one newline

* fix windows newline

* fix macos newline
2023-03-08 21:34:20 +08:00
sigoden
56483e04f0
feat: add role-specific config (#42)
Now we can set role temperature. For example:

```
- name: shell
  prompt: >
    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.4
```
2023-03-08 19:43:11 +08:00
sigoden
2539e24fe9
chore: improve code by getting prompt from config (#39) 2023-03-08 17:13:11 +08:00
sigoden
ee81275431
fix: windows no stream output (#37) 2023-03-08 16:17:51 +08:00
sigoden
2a7a6f5f27 chore: no longer ignore any error 2023-03-08 16:06:24 +08:00
sigoden
4e729db237 chore: optimize output newline 2023-03-08 13:58:50 +08:00
sigoden
f694a59dcc
refactor: replace dump with print_now! (#35) 2023-03-08 11:58:50 +08:00
sigoden
b7cb6f89f1
fix: repl set save true not work if not rerun(#34) 2023-03-08 11:27:51 +08:00
sigoden
b05fce7bca
refactor: split long paragraphs for smoother stream output (#33) 2023-03-08 10:40:19 +08:00
sigoden
ec1c4bcf8f
refactor: theme and code color (#32) 2023-03-08 07:25:32 +08:00
sigoden
360264121c
feat: command mode supports stream out (#31)
* feat: command mode supports stream out

* update cli
2023-03-07 22:33:34 +08:00
sigoden
c7fcdb1744
refactor: adjust repl (#30)
- abandon .copy
- rename .multiple => .editor
- if command successed, do not output `Done`
- if command failed, output `Error: <error message>`
2023-03-07 19:04:54 +08:00
sigoden
d73be65b07
refactor: support highlighting more languages (#28) 2023-03-07 15:37:03 +08:00
sigoden
11dc4d104b
refactor: optimize ctrl+c/ctrl+d abort handling (#27) 2023-03-07 11:51:52 +08:00
sigoden
1640456049
refactor: use syntect for highlight, abandon mdcat (#26)
* refactor: use syntect for highlight, abandon mdcat

* split src/render.rs to sub modules. embed a default theme

* simulate typing effect.

* fix format
2023-03-07 11:38:44 +08:00
sigoden
c12ae02751 chore: improve code by renameing some function 2023-03-06 16:35:51 +08:00
sigoden
f73f45ac9b chore: update deps 2023-03-06 15:47:46 +08:00
sigoden
6e389d794e chore: update tool description 2023-03-06 13:37:34 +08:00
sigoden
0874cecba8 chore: update readme 2023-03-06 13:00:43 +08:00
sigoden
281e15cbd1 chore: release v0.4.0 really 2023-03-06 10:57:09 +08:00
sigoden
056f38428c
fix: $AI_CONFIG_DIR points to the parent directory (#25) 2023-03-06 10:47:50 +08:00
sigoden
ffa444399f chore: release v0.4.0 2023-03-06 10:34:07 +08:00
sigoden
f29ca57446 chore: optimize cli help 2023-03-06 10:08:59 +08:00
sigoden
cfb46ca0de
feat: add --no-highlight option (#24) 2023-03-06 09:27:49 +08:00
sigoden
7def9aef01
fix: combine pipe and cli args, disable highlight when pipe (#23) 2023-03-06 08:43:24 +08:00
sigoden
c5a2f4603c chore: optimize code 2023-03-06 07:08:51 +08:00
sigoden
2152667fc6
refactor: split src/repl.rs to submodules (#22) 2023-03-06 06:45:00 +08:00
sigoden
d40913d739
feat: add .prompt command (#21)
* feat: add `.prompt` command

* set temp role name
2023-03-06 05:30:20 +08:00
sigoden
4b1d6c16b3
feat: add .set command (#20)
* feat: add `.set` command

* Add config.role
2023-03-05 22:51:29 +08:00
sigoden
957ea431c2
refactor: rename config.no_highlight to highlight (#19) 2023-03-05 19:48:22 +08:00
sigoden
aadffb17a3
feat: repl command replaces .editor with .multiline (#18)
You can use `.multiline` command to put multiline content

```
〉.multiline {
::: abc
::: cdf
::: }
```
It's much easier than `.editor`.
2023-03-05 19:16:41 +08:00