-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
工具名称为空或错误时,跳过注册 #605
base: master
Are you sure you want to change the base?
工具名称为空或错误时,跳过注册 #605
Conversation
尝试在‘tool_name'为空或者错误时,跳过自定义工具的注册 |
modelscope_agent/agent.py
Outdated
# Check if tool is a dictionary and extract the tool name | ||
if isinstance(tool, dict): | ||
tool_name = next(iter(tool), None) # Use None as default to handle empty dict | ||
tool_cfg = tool[tool_name] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KeyError
modelscope_agent/tools/base.py
Outdated
@@ -368,6 +368,11 @@ def parse_service_response(response): | |||
|
|||
def _register_tool(self): | |||
try: | |||
# 检查tool_name是否已定义且非空 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
English
modelscope_agent/tools/base.py
Outdated
@@ -368,6 +368,11 @@ def parse_service_response(response): | |||
|
|||
def _register_tool(self): | |||
try: | |||
# 检查tool_name是否已定义且非空 | |||
if not hasattr(self, 'tool_name') or not self.tool_name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if getattr(self, 'tool_name', None) is None
Change Summary
Related issue number
Checklist
pre-commit install
andpre-commit run --all-files
before git commit, and passed lint check.