Skip to content

Commit e71ac15

Browse files
committed
doc: update readme
1 parent 371f272 commit e71ac15

File tree

7 files changed

+20
-4
lines changed

7 files changed

+20
-4
lines changed

README-cn.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ aoi
3030
```
3131

3232
## 演示
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)
3438

3539
## 贡献
3640
如果在使用 Aoi 时发现任何问题或有新功能的建议,请在 GitHub 存储库上创建问题或提交拉取请求。

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ aoi
3434
```
3535

3636
## Demos
37-
[![asciicast](https://asciinema.org/a/XjCGaMNf8Qp2nQ1UDlehjm5AN.svg)](https://asciinema.org/a/XjCGaMNf8Qp2nQ1UDlehjm5AN)
3837

38+
### shell
39+
[![shell](/doc/shell.gif)](https://asciinema.org/a/XjCGaMNf8Qp2nQ1UDlehjm5AN)
3940

41+
### database
42+
[![pg](/doc/pg.gif)](https://asciinema.org/a/daDIFLigVJQLnd6U94VxyjHFD)
4043
## Contributing
4144
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!

doc/pg.gif

124 KB
Loading

doc/shell.gif

452 KB
Loading

main.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,18 @@ func main() {
6565
if input == "" {
6666
continue
6767
}
68-
rl.SaveHistory(input)
68+
_ = rl.SaveHistory(input)
6969
fmt.Println(color.Green(cmd.Prompt("Aoi")))
7070

7171
if strings.HasPrefix(input, "/debug") {
7272
fmt.Println("debug: ", ai.ToggleDebug())
7373
continue
7474
}
75+
if strings.HasPrefix(input, "/reset") {
76+
ai.Reset()
77+
fmt.Println("reset")
78+
continue
79+
}
7580
if strings.HasPrefix(input, "/copy") {
7681
if err := clipboard.WriteAll(lastReply); err != nil {
7782
fmt.Println(err)

pkg/chatgpt/ai.go

+4
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ func (ai *AI) ToggleDebug() bool {
9292
return ai.debug
9393
}
9494

95+
func (ai *AI) Reset() {
96+
ai.messages = ai.messages[:1]
97+
}
98+
9599
func NewMessage(role, text string) openai.ChatCompletionMessage {
96100
return openai.ChatCompletionMessage{
97101
Role: role,

pkg/command/db.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (c *DB) ExecSQL(sql string) error {
126126
// TODO: fix panic in rest-go/rest/pkg/sql
127127
defer func() {
128128
if r := recover(); r != nil {
129-
fmt.Println("panic when query database:", r)
129+
fmt.Println("panic when query database:", r, sql)
130130
fmt.Println()
131131
}
132132
}()

0 commit comments

Comments
 (0)