From 43d07de810da89e27eb936a19931a19ba8c6a4b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Fri, 5 Jan 2024 11:02:41 +0800 Subject: [PATCH] feat: Replace the actual root directory name of the project codes with a fake one in the WriteTest prompt. --- metagpt/actions/write_test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metagpt/actions/write_test.py b/metagpt/actions/write_test.py index 0166f5417..96486311f 100644 --- a/metagpt/actions/write_test.py +++ b/metagpt/actions/write_test.py @@ -11,7 +11,6 @@ from typing import Optional from metagpt.actions.action import Action -from metagpt.config import CONFIG from metagpt.const import TEST_CODES_FILE_REPO from metagpt.logs import logger from metagpt.schema import Document, TestingContext @@ -60,11 +59,12 @@ class WriteTest(Action): self.context.test_doc = Document( filename="test_" + self.context.code_doc.filename, root_path=TEST_CODES_FILE_REPO ) + fake_root = "/data" prompt = PROMPT_TEMPLATE.format( code_to_test=self.context.code_doc.content, test_file_name=self.context.test_doc.filename, - source_file_path=self.context.code_doc.root_relative_path, - workspace=CONFIG.git_repo.workdir, + source_file_path=fake_root + "/" + self.context.code_doc.root_relative_path, + workspace=fake_root, ) self.context.test_doc.content = await self.write_code(prompt) return self.context