Implement forced tool selection in AIClient and OpenAIModel, enhancing tool invocation capabilities. Added methods for extracting forced tool names from user messages and updated logging to reflect forced tool usage. Improved error handling for timeout scenarios in message handling and model interactions, ensuring better user feedback and robustness.
This commit is contained in:
@@ -37,3 +37,9 @@ def test_extract_forced_tool_name_ambiguous_prefix_returns_none():
|
||||
forced = AIClient._extract_forced_tool_name(message, tools)
|
||||
|
||||
assert forced is None
|
||||
|
||||
|
||||
def test_extract_prefix_limit_from_user_message():
|
||||
assert AIClient._extract_prefix_limit("直接返回前100字") == 100
|
||||
assert AIClient._extract_prefix_limit("前 256 字") == 256
|
||||
assert AIClient._extract_prefix_limit("返回全文") is None
|
||||
|
||||
Reference in New Issue
Block a user