Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yrk111222
Copy link

Change Summary

Related issue number

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Run pre-commit install and pre-commit run --all-files before git commit, and passed lint check.
  • Some cases need DASHSCOPE_TOKEN_API to pass the Unit Tests, I have at least pass the Unit tests on local
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@yrk111222
Copy link
Author

尝试在‘tool_name'为空或者错误时,跳过自定义工具的注册

# 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]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KeyError

@@ -368,6 +368,11 @@ def parse_service_response(response):

def _register_tool(self):
try:
# 检查tool_name是否已定义且非空

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

English

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

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

@suluyana suluyana changed the base branch from master to fix/on_line November 26, 2024 10:24
@suluyana suluyana changed the base branch from fix/on_line to master November 26, 2024 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants