refactor: 移除废弃的 calculator 内置工具
计算器功能已不再需要,移除相关代码以简化工具集。 Co-authored-by: xerrors <xerrors@qq.com>
This commit is contained in:
parent
c342f3e1ee
commit
17b521796c
@ -1,10 +1,9 @@
|
||||
# buildin 工具包
|
||||
from .install_skill import install_skill
|
||||
from .tools import ask_user_question, calculator, present_artifacts, text_to_img_qwen_image
|
||||
from .tools import ask_user_question, present_artifacts, text_to_img_qwen_image
|
||||
|
||||
__all__ = [
|
||||
"ask_user_question",
|
||||
"calculator",
|
||||
"install_skill",
|
||||
"present_artifacts",
|
||||
"text_to_img_qwen_image",
|
||||
|
||||
@ -110,27 +110,6 @@ def _normalize_presented_artifact_path(filepath: str, runtime: ToolRuntime) -> s
|
||||
return f"{outputs_virtual_prefix}/{relative_path.as_posix()}"
|
||||
|
||||
|
||||
@tool(category="buildin", tags=["计算"], display_name="计算器")
|
||||
def calculator(a: float, b: float, operation: str) -> float:
|
||||
"""计算器:对给定的2个数字进行基本数学运算"""
|
||||
try:
|
||||
if operation == "add":
|
||||
return a + b
|
||||
elif operation == "subtract":
|
||||
return a - b
|
||||
elif operation == "multiply":
|
||||
return a * b
|
||||
elif operation == "divide":
|
||||
if b == 0:
|
||||
raise ZeroDivisionError("除数不能为零")
|
||||
return a / b
|
||||
else:
|
||||
raise ValueError(f"不支持的运算类型: {operation},仅支持 add, subtract, multiply, divide")
|
||||
except Exception as e:
|
||||
logger.error(f"Calculator error: {e}")
|
||||
raise
|
||||
|
||||
|
||||
PRESENT_ARTIFACTS_DESCRIPTION = f"""
|
||||
将已经生成好的结果文件展示给用户。
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user