File tree 7 files changed +20
-4
lines changed
7 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 30
30
```
31
31
32
32
## 演示
33
- [ ![ asciicast] ( https://asciinema.org/a/XjCGaMNf8Qp2nQ1UDlehjm5AN.svg )] ( https://asciinema.org/a/XjCGaMNf8Qp2nQ1UDlehjm5AN )
33
+ ### shell
34
+ [ ![ shell] ( /doc/shell.gif )] ( https://asciinema.org/a/XjCGaMNf8Qp2nQ1UDlehjm5AN )
35
+
36
+ ### database
37
+ [ ![ pg] ( /doc/pg.gif )] ( https://asciinema.org/a/daDIFLigVJQLnd6U94VxyjHFD )
34
38
35
39
## 贡献
36
40
如果在使用 Aoi 时发现任何问题或有新功能的建议,请在 GitHub 存储库上创建问题或提交拉取请求。
Original file line number Diff line number Diff line change 34
34
```
35
35
36
36
## Demos
37
- [ ![ asciicast] ( https://asciinema.org/a/XjCGaMNf8Qp2nQ1UDlehjm5AN.svg )] ( https://asciinema.org/a/XjCGaMNf8Qp2nQ1UDlehjm5AN )
38
37
38
+ ### shell
39
+ [ ![ shell] ( /doc/shell.gif )] ( https://asciinema.org/a/XjCGaMNf8Qp2nQ1UDlehjm5AN )
39
40
41
+ ### database
42
+ [ ![ pg] ( /doc/pg.gif )] ( https://asciinema.org/a/daDIFLigVJQLnd6U94VxyjHFD )
40
43
## Contributing
41
44
If you find any issues with Aoi or have suggestions for new features, please feel free to create an issue or submit a pull request on the GitHub repository. Contributions from anyone and everyone are welcome!
Original file line number Diff line number Diff line change @@ -65,13 +65,18 @@ func main() {
65
65
if input == "" {
66
66
continue
67
67
}
68
- rl .SaveHistory (input )
68
+ _ = rl .SaveHistory (input )
69
69
fmt .Println (color .Green (cmd .Prompt ("Aoi" )))
70
70
71
71
if strings .HasPrefix (input , "/debug" ) {
72
72
fmt .Println ("debug: " , ai .ToggleDebug ())
73
73
continue
74
74
}
75
+ if strings .HasPrefix (input , "/reset" ) {
76
+ ai .Reset ()
77
+ fmt .Println ("reset" )
78
+ continue
79
+ }
75
80
if strings .HasPrefix (input , "/copy" ) {
76
81
if err := clipboard .WriteAll (lastReply ); err != nil {
77
82
fmt .Println (err )
Original file line number Diff line number Diff line change @@ -92,6 +92,10 @@ func (ai *AI) ToggleDebug() bool {
92
92
return ai .debug
93
93
}
94
94
95
+ func (ai * AI ) Reset () {
96
+ ai .messages = ai .messages [:1 ]
97
+ }
98
+
95
99
func NewMessage (role , text string ) openai.ChatCompletionMessage {
96
100
return openai.ChatCompletionMessage {
97
101
Role : role ,
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ func (c *DB) ExecSQL(sql string) error {
126
126
// TODO: fix panic in rest-go/rest/pkg/sql
127
127
defer func () {
128
128
if r := recover (); r != nil {
129
- fmt .Println ("panic when query database:" , r )
129
+ fmt .Println ("panic when query database:" , r , sql )
130
130
fmt .Println ()
131
131
}
132
132
}()
You can’t perform that action at this time.
0 commit comments