From c4e72507e0ee153961d185422ad691e015e05256 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Thu, 14 Dec 2023 15:59:04 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=9C=BA=E5=99=A8=E4=BA=BA=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=B8=85=E7=A9=BA=E4=B8=8A=E4=B8=8B=E6=96=87=E8=8F=9C?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/UserBot.php | 9 +++++++++ app/Tasks/BotReceiveMsgTask.php | 3 +++ 2 files changed, 12 insertions(+) diff --git a/app/Models/UserBot.php b/app/Models/UserBot.php index 8208075b9..c28d297b8 100644 --- a/app/Models/UserBot.php +++ b/app/Models/UserBot.php @@ -114,6 +114,15 @@ class UserBot extends AbstractModel 'label' => Doo::translate('我的机器人') ], ], + 'ai-openai@bot.system', + 'ai-claude@bot.system', + 'ai-wenxin@bot.system', + 'ai-qianwen@bot.system' => [ + [ + 'key' => '%3A.clear', + 'label' => Doo::translate('清空上下文') + ] + ], default => [], }; diff --git a/app/Tasks/BotReceiveMsgTask.php b/app/Tasks/BotReceiveMsgTask.php index a51ddbad8..6c5f4aacb 100644 --- a/app/Tasks/BotReceiveMsgTask.php +++ b/app/Tasks/BotReceiveMsgTask.php @@ -71,6 +71,9 @@ class BotReceiveMsgTask extends AbstractTask } if (preg_match("/]*?data-quick-key=([\"'])(.*?)\\1[^>]*?>(.*?)<\/span>/is", $original, $match)) { $command = $match[2]; + if (str_starts_with($command, '%3A.')) { + $command = ":" . substr($command, 4); + } } else { $command = trim(strip_tags($original)); }