diff --git "a/Agent\347\232\204\346\246\202\345\277\265\343\200\201\345\216\237\347\220\206\344\270\216\346\236\204\345\273\272\346\250\241\345\274\217/agent.py" "b/Agent\347\232\204\346\246\202\345\277\265\343\200\201\345\216\237\347\220\206\344\270\216\346\236\204\345\273\272\346\250\241\345\274\217/agent.py" index 55d9308..6dded5a 100644 --- "a/Agent\347\232\204\346\246\202\345\277\265\343\200\201\345\216\237\347\220\206\344\270\216\346\236\204\345\273\272\346\250\241\345\274\217/agent.py" +++ "b/Agent\347\232\204\346\246\202\345\277\265\343\200\201\345\216\237\347\220\206\344\270\216\346\236\204\345\273\272\346\250\241\345\274\217/agent.py" @@ -88,7 +88,8 @@ def render_system_prompt(self, system_prompt_template: str) -> str: return Template(system_prompt_template).substitute( operating_system=self.get_operating_system_name(), tool_list=tool_list, - file_list=file_list + file_list=file_list, + project_directory=self.project_directory, ) @staticmethod @@ -207,7 +208,12 @@ def run_terminal_command(command): """用于执行终端命令""" import subprocess run_result = subprocess.run(command, shell=True, capture_output=True, text=True) - return "执行成功" if run_result.returncode == 0 else run_result.stderr + if run_result.returncode != 0: + return run_result.stderr + msg = ["执行成功"] + if run_result: + msg.append(run_result.stdout) + return ": ".join(msg) @click.command() @click.argument('project_directory', diff --git "a/Agent\347\232\204\346\246\202\345\277\265\343\200\201\345\216\237\347\220\206\344\270\216\346\236\204\345\273\272\346\250\241\345\274\217/prompt_template.py" "b/Agent\347\232\204\346\246\202\345\277\265\343\200\201\345\216\237\347\220\206\344\270\216\346\236\204\345\273\272\346\250\241\345\274\217/prompt_template.py" index bcb3af5..9ae497e 100644 --- "a/Agent\347\232\204\346\246\202\345\277\265\343\200\201\345\216\237\347\220\206\344\270\216\346\236\204\345\273\272\346\250\241\345\274\217/prompt_template.py" +++ "b/Agent\347\232\204\346\246\202\345\277\265\343\200\201\345\216\237\347\220\206\344\270\216\346\236\204\345\273\272\346\250\241\345\274\217/prompt_template.py" @@ -40,6 +40,13 @@ - 输出 后立即停止生成,等待真实的 ,擅自生成 将导致错误 - 如果 中的某个工具参数有多行的话,请使用 \n 来表示,如:write_to_file("/tmp/test.txt", "a\nb\nc") - 工具参数中的文件路径请使用绝对路径,不要只给出一个文件名。比如要写 write_to_file("/tmp/test.txt", "内容"),而不是 write_to_file("test.txt", "内容") +- 中的内容可以是“成功执行“,代表工具执行成功。后面也可能跟有工具返回的数据 +- 所有新创建的文件都应保存在项目目录下 + +⸻ + +本次任务的项目目录是: +${project_directory} ⸻