From 8c11f4850225d5e63e9310951cb6a88a98ec73b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Mon, 17 Feb 2025 23:31:11 +0900 Subject: [PATCH] fix(thesaurus): cnfd. calc. --- plugin/thesaurus/chat.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugin/thesaurus/chat.go b/plugin/thesaurus/chat.go index 69b2051e..ed95bb9b 100644 --- a/plugin/thesaurus/chat.go +++ b/plugin/thesaurus/chat.go @@ -84,8 +84,20 @@ func init() { engine.OnMessage(zero.OnlyToMe, canmatch(tKIMO)). SetBlock(false).Handle(func(ctx *zero.Ctx) { - r, err := kimoi.Chat(ctx.ExtractPlainText()) - if err == nil && r.Confidence > 0.5 && r.Confidence < 0.95 { + msg := ctx.ExtractPlainText() + r, err := kimoi.Chat(msg) + if err == nil { + c := 0 + for r.Confidence < 0.5 && c < 3 { + r, err = kimoi.Chat(msg) + if err != nil { + return + } + c++ + } + if r.Confidence < 0.5 { + return + } ctx.Block() ctx.SendChain(message.Text(r.Reply)) }