Skip to content

[Bug]调用py执行时意外的“code”关键词参数 #2988

@MoonShadow1976

Description

@MoonShadow1976

发生了什么

 [07:52:26] [Core] [INFO] [respond.stage:161]: Prepare to send - 🌙moons/3483948113:   
 [07:52:26] [Core] [INFO] [respond.stage:188]: 消息为空,跳过发送阶段 
 [07:52:26] [Core] [INFO] [runners.tool_loop_agent_runner:187]: Agent 使用工具: ['python_interpreter'] 
 [07:52:26] [Core] [INFO] [runners.tool_loop_agent_runner:199]: 使用工具:python_interpreter,参数:{'code': "import matplotlib.pyplot as plt\nimport numpy as np\n\n# 假设方程为 x^2 + y^2 + cx + dy = 1(原方程可能存在笔误)\n# 修正并绘制包络线示意图\n# 这里以通用二次曲线形式展示\nx = np.linspace(-2, 2, 400)\ny = np.linspace(-2, 2, 400)\nX, Y = np.meshgrid(x, y)\n\n# 示例:假设原意为 x^2 + y^2 + cx + dy = 1\n# 取c=1作为示例参数\nZ = X**2 + Y**2 + 1*X + 1*Y\n\nplt.contour(X, Y, Z, levels=[1], colors='blue')\nplt.title('Contour of x² + y² + cx + dy = 1 (c=1)')\nplt.xlabel('x')\nplt.ylabel('y')\nplt.grid(True)\nplt.axhline(0, color='black', linewidth=0.5)\nplt.axvline(0, color='black', linewidth=0.5)\nplt.show()"} 
 [07:52:26] [Core] [ERRO] [pipeline.context_utils:37]: 处理函数参数不匹配,请检查 handler 的定义。 
Traceback (most recent call last):
  File "/root/ChartBot/AstrBot/astrbot/core/pipeline/context_utils.py", line 35, in call_handler
    ready_to_call = handler(event, *args, **kwargs)
TypeError: Main.python_interpreter() got an unexpected keyword argument 'code'

调用失败,是模型的问题吗

如何复现?

4.3.2astrbot
硅基流动qwen8B模型
linux uv部署

at bot要求 画x2+cx+cy2=1的包络线示意图

AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

如上

操作系统

Windows

报错日志

如上

你愿意提交 PR 吗?

  • 是的,我愿意提交 PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions