mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-01-26 18:12:47 +08:00
✨ 优化函数参数解析,增加对JSON解析错误的处理;更新run_shell_command描述
This commit is contained in:
parent
dacb5aa854
commit
006f925afd
@ -323,6 +323,9 @@ async def marsho(
|
|||||||
if isinstance(
|
if isinstance(
|
||||||
tool_call, ChatCompletionsToolCall
|
tool_call, ChatCompletionsToolCall
|
||||||
): # 循环调用工具直到不需要调用
|
): # 循环调用工具直到不需要调用
|
||||||
|
try:
|
||||||
|
function_args = json.loads(tool_call.function.arguments)
|
||||||
|
except json.JSONDecodeError:
|
||||||
function_args = json.loads(
|
function_args = json.loads(
|
||||||
tool_call.function.arguments.replace("'", '"')
|
tool_call.function.arguments.replace("'", '"')
|
||||||
)
|
)
|
||||||
|
@ -97,9 +97,7 @@ async def run_python_code(code: str, b: Bot, e: MessageEvent) -> str:
|
|||||||
|
|
||||||
@on_function_call(
|
@on_function_call(
|
||||||
description="在设备上运行shell命令, Run command on this device"
|
description="在设备上运行shell命令, Run command on this device"
|
||||||
).params(command=String(description="shell命令内容")).permission(SUPERUSER).name(
|
).params(command=String(description="shell命令内容")).permission(SUPERUSER)
|
||||||
"run_shell_command"
|
|
||||||
)
|
|
||||||
async def run_shell_command(command: str, b: Bot, e: MessageEvent) -> str:
|
async def run_shell_command(command: str, b: Bot, e: MessageEvent) -> str:
|
||||||
"""运行shell命令"""
|
"""运行shell命令"""
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user