Skip to content

Commit 8c11f48

Browse files
committed
fix(thesaurus): cnfd. calc.
1 parent e12ec69 commit 8c11f48

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

plugin/thesaurus/chat.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,20 @@ func init() {
8484

8585
engine.OnMessage(zero.OnlyToMe, canmatch(tKIMO)).
8686
SetBlock(false).Handle(func(ctx *zero.Ctx) {
87-
r, err := kimoi.Chat(ctx.ExtractPlainText())
88-
if err == nil && r.Confidence > 0.5 && r.Confidence < 0.95 {
87+
msg := ctx.ExtractPlainText()
88+
r, err := kimoi.Chat(msg)
89+
if err == nil {
90+
c := 0
91+
for r.Confidence < 0.5 && c < 3 {
92+
r, err = kimoi.Chat(msg)
93+
if err != nil {
94+
return
95+
}
96+
c++
97+
}
98+
if r.Confidence < 0.5 {
99+
return
100+
}
89101
ctx.Block()
90102
ctx.SendChain(message.Text(r.Reply))
91103
}

0 commit comments

Comments
 (0)