AstrBot icon indicating copy to clipboard operation
AstrBot copied to clipboard

local模式下shell工具和python工具的工作目录不一致的问题

Open Rikkawaii opened this issue 5 months ago • 0 comments

背景 local模式下系统提示词声明了当前工作目录是{AstrBot root}\data\workspaces{normalized_umo}

        if config.computer_use_runtime == "local":
            tool_prompt += (
                f"\nCurrent workspace you can use: "
                f"`{_get_workspace_path_for_umo(event.unified_msg_origin)}`\n"
                "Unless the user explicitly specifies a different directory, "
                "perform all file-related operations in this workspace.\n"
            )

shell工具也是以该目录为工作目录的。 而python工具默认是以{AstrBot root}为工作目录,这就导致python工具创建或修改的文件,bot总是需要搜索好几遍才能正确拿到文件路径。 建议

  • 提示词加上python工具工作目录的描述

或

  • 每次执行python工具时,插入切换工作目录到{AstrBot root}\data\workspaces{normalized_umo}的代码

Rikkawaii avatar Jun 11 '26 13:06 Rikkawaii