✨ Add Chinese localization for tool descriptions#2527
Open
geruihappy-creator wants to merge 22 commits intodevelopfrom
Open
✨ Add Chinese localization for tool descriptions#2527geruihappy-creator wants to merge 22 commits intodevelopfrom
geruihappy-creator wants to merge 22 commits intodevelopfrom
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
YehongPan
reviewed
Feb 14, 2026
backend/database/tool_db.py
Outdated
|
|
||
|
|
||
| def add_tool_field(tool_info): | ||
| from services.tool_configuration_service import get_local_tools_description_zh |
Collaborator
Author
There was a problem hiding this comment.
已修正,谢谢。通过新建模块,确认该函数处不会循环导入,将from import前置到开头管理
Collaborator
Author
There was a problem hiding this comment.
已修正,谢谢。通过新建模块,确认该函数处不会循环导入,将from import前置到开头管理
YehongPan
reviewed
Feb 14, 2026
YehongPan
reviewed
Feb 14, 2026
Jasonxia007
reviewed
Feb 24, 2026
Jasonxia007
reviewed
Feb 24, 2026
Pre-download tiktoken cl100k_base model
…thentication. 🐛 Bugfix: The agent_run process cannot invoke the MCP service with authentication.
1. 抽取 get_local_tools_description_zh 到独立模块 tool_local_service.py,避免循环导入 2. ToolInfo 模型添加 params: List 字段 3. 移除用户不感知参数(exclude=True)的 description_zh 4. 修复 send_email_tool description 中的 typo
c8c33de to
8447f08
Compare
added 7 commits
March 11, 2026 10:41
- Restore SSETransport and StreamableHttpTransport imports - Restore get_mcp_authorization_token_by_name_and_url import - Restore _create_mcp_transport function - Update get_tool_from_remote_mcp_server to support tenant_id and authorization_token - Update _call_mcp_tool to support authorization_token - Update _validate_mcp_tool_remote to get authorization token from database - Update get_all_mcp_tools to pass tenant_id
…description_zh - Update mock paths from tool_configuration_service to tool_local_service - Fix mock tool classes to use Field() for default values - Update test_tool_db.py mock module setup
- Restore MCP tools unique key logic (name&source&usage) in update_tool_table_from_scan_tool_list - Add user_id to MockToolInstanceClass in test - Fix mock path for get_local_tools_description_zh in test_tool_db.py
…ool_by_tool_info logic - Add ToolSourceEnum import to tool_db.py - Restore create_or_update_tool_by_tool_info to not filter by user_id - Restore proper ToolInstance creation logic
- Add tests for get_local_tools with description_zh extraction - Add tests for list_all_tools merging description_zh from SDK - Add tests for add_tool_field merging params and inputs description_zh - Add tests for get_local_tools_classes direct call - Add edge case tests for JSON decode errors and missing attributes
- Fix mock path from tool_local_service to tool_configuration_service for get_local_tools_classes - Fix mock path for get_local_tools_description_zh - Add @pytest.mark.asyncio for async list_all_tools tests - Mock importlib.import_module for get_local_tools_classes direct test
Pydantic V2 doesn't support Field(description_zh=...) directly. The actual tool classes use init_param_descriptions class attribute for parameter description_zh. Updated get_local_tools() to check init_param_descriptions as fallback when param.default.description_zh is not available.
WMC001
reviewed
Mar 12, 2026
backend/database/tool_db.py
Outdated
| from database.client import get_db_session, filter_property, as_dict | ||
| from database.db_models import ToolInstance, ToolInfo | ||
| from consts.model import ToolSourceEnum | ||
| from services.tool_local_service import get_local_tools_description_zh |
WMC001
reviewed
Mar 12, 2026
| return tools_classes | ||
|
|
||
|
|
||
| def get_local_tools_description_zh() -> Dict[str, Dict]: |
xuyaqist
reviewed
Mar 12, 2026
| init_params_list = [] | ||
| sig = inspect.signature(tool_class.__init__) | ||
| for param_name, param in sig.parameters.items(): | ||
| if param_name == "self" or param.default.exclude: |
Contributor
There was a problem hiding this comment.
这段代码直接访问了 param.default.exclude,而没有检查 param.default 是否存在或是否具有 exclude 属性。如果工具类中存在任何没有 Pydantic 字段默认值的参数,则 param.default 将为 inspect.Parameter.empty,缺少 exclude 属性,从而导致工具自省期间发生 AttributeError 崩溃。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
本地工具描述的国际化,在智能体开发、智能体空间和市场页作适配


