Add compact identifier method for fuzzy matching in AIClient
Introduced a static method to compact identifiers for improved fuzzy matching of tool names, allowing for more flexible user input. Updated the tool name extraction logic to support matching without underscores or dots, enhancing the tool invocation capabilities. Added a corresponding test to validate the new functionality.
This commit is contained in:
@@ -27,6 +27,18 @@ def test_extract_forced_tool_name_unique_prefix():
|
||||
assert forced == "humanizer_zh.read_skill_doc"
|
||||
|
||||
|
||||
def test_extract_forced_tool_name_compact_prefix_without_underscore():
|
||||
tools = [
|
||||
"humanizer_zh.read_skill_doc",
|
||||
"skills_creator.create_skill",
|
||||
]
|
||||
message = "调用humanizerzh人性化处理以下文本"
|
||||
|
||||
forced = AIClient._extract_forced_tool_name(message, tools)
|
||||
|
||||
assert forced == "humanizer_zh.read_skill_doc"
|
||||
|
||||
|
||||
def test_extract_forced_tool_name_ambiguous_prefix_returns_none():
|
||||
tools = [
|
||||
"skills_creator.create_skill",
|
||||
|
||||
Reference in New Issue
Block a user