ai建议修改

pull/1001/head
SnowindMe 2025-04-19 18:47:38 +08:00
parent 3f293a2010
commit 9b96054c3c
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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()