mirror of https://github.com/Mai-with-u/MaiBot.git
ai建议修改
parent
3f293a2010
commit
9b96054c3c
|
|
@ -32,6 +32,8 @@ class CompareNumbersTool(BaseTool):
|
|||
try:
|
||||
num1 = function_args.get("num1")
|
||||
num2 = function_args.get("num2")
|
||||
if not (isinstance(num1, (int, float)) and isinstance(num2, (int, float))):
|
||||
raise ValueError("参数'num1'和'num2'必须为数字")
|
||||
lua_code = """
|
||||
function CompareNumbers(a, b)
|
||||
return a .. (a > b and " 大于 " or a < b and " 小于 " or " 等于 ") .. b
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ class LetterCountTool(BaseTool):
|
|||
try:
|
||||
word = function_args.get("word")
|
||||
letter = function_args.get("letter")
|
||||
if re.match(r"^[a-zA-Z]+$", letter) is None:
|
||||
raise ValueError("请输入英文字母")
|
||||
if re.match(r"^[a-zA-Z]$", letter) is None:
|
||||
raise ValueError("请输入单个英文字母")
|
||||
lua_code = """
|
||||
function LetterCount(inputStr, targetLetter)
|
||||
local lower = (inputStr:gsub("[^"..targetLetter:lower().."]", "")):len()
|
||||
|
|
|
|||
Loading…
Reference in New Issue