mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-08-01 16:39:52 +00:00
✨ 优化函数参数解析,增加对JSON解析错误的处理;更新run_shell_command描述
This commit is contained in:
@ -323,9 +323,12 @@ async def marsho(
|
||||
if isinstance(
|
||||
tool_call, ChatCompletionsToolCall
|
||||
): # 循环调用工具直到不需要调用
|
||||
function_args = json.loads(
|
||||
tool_call.function.arguments.replace("'", '"')
|
||||
)
|
||||
try:
|
||||
function_args = json.loads(tool_call.function.arguments)
|
||||
except json.JSONDecodeError:
|
||||
function_args = json.loads(
|
||||
tool_call.function.arguments.replace("'", '"')
|
||||
)
|
||||
logger.info(
|
||||
f"调用函数 {tool_call.function.name} ,参数为 {function_args}"
|
||||
)
|
||||
|
Reference in New Issue
Block a user