perf: 机器人添加清空上下文菜单

This commit is contained in:
kuaifan 2023-12-14 15:59:04 +08:00
parent d06d1c177c
commit c4e72507e0
2 changed files with 12 additions and 0 deletions

View File

@ -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 => [],
};

View File

@ -71,6 +71,9 @@ class BotReceiveMsgTask extends AbstractTask
}
if (preg_match("/<span[^>]*?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));
}