fix bad cases

This commit is contained in:
黄伟韬 2024-10-15 20:35:11 +08:00
parent 3b8740f078
commit a41956f85f
5 changed files with 9 additions and 9 deletions

View file

@ -44,10 +44,11 @@ Note:
21. When planning, consider whether images are needed. If you are developing a showcase website, start by using ImageGetter.get_image to obtain the necessary images.
22. When planning, merge multiple tasks that operate on the same file into a single task. For example, create one task for writing unit tests for all functions in a class. Also in using the editor, merge multiple tasks that operate on the same file into a single task.
23. When create unit tests for a code file, use Editor.read() to read the code file before planing. And create one plan to writing the unit test for the whole file.
24. Follow the Sytem Design and Project Schedule if exists. Otherwise, use default template folder of Vite, React, MUI and Tailwind CSS. The React template is in the "{react_template_path}" and Vue template is in the "{vue_template_path}". If the template does not exist, use native HTML.
25. When writing Vue/React project:
24. the priority to select technical stack: Describe in Sytem Design and Project Schedule > Vite, React, MUI and Tailwind CSS > native HTML
24.1. The React template is in the "{react_template_path}" and Vue template is in the "{vue_template_path}".
25. If no programmming language is specified, use Vue/React project. Do the following steps:
25.1. Create the project folder first. Use cmd " mkdir -p {{project_name}} "
25.2. Copy a Vue/React template to your project folder, move into it and list the file in it. This must be a single respond. Use cmd "cp -r {{template_folder}}/* {{workspace}}/{{project_name}}/ && cd {{workspace}}/{{project_name}} && pwd && tree -f".
25.2. Copy a Vue/React template to your project folder, move into it and list the file in it. Use cmd "cp -r {{template_folder}}/* {{workspace}}/{{project_name}}/ && cd {{workspace}}/{{project_name}} && pwd && tree -f". This must be a single response without other commands.
25.3. User Editor.read to read the content of files in the src and read the index.html in the project root before making a plan.
25.4. List the files that you need to rewrite and create when making a plan. Indicate clearly what file to rewrite or create in each task. "index.html" and all files in the src folder always must be rewritten. Use Tailwind CSS for styling. Notice that you are in {{project_name}}.
25.5. After finish the project. use "pnpm install && pnpm run build" to build the project and then deploy the project to the public using the dist folder which contains the built project.

View file

@ -150,8 +150,7 @@ class Engineer2(RoleZero):
default_dir = self.editor._try_fix_path(dist_dir)
if not default_dir.exists():
raise ValueError("dist_dir must be an absolute path.")
else:
dist_dir = default_dir
dist_dir = default_dir
return await self.deployer.deploy_to_public(dist_dir)
async def _eval_terminal_run(self, cmd):

View file

@ -535,7 +535,7 @@ class RoleZero(Role):
command_output = await self._end()
elif cmd["command_name"] == "RoleZero.ask_human":
human_response = await self.ask_human(**cmd["args"])
if "<STOP>" in human_response:
if "stop" in human_response.lower():
human_response += "The user has asked me to stop because I have encountered a problem."
self.rc.memory.add(UserMessage(content=human_response, cause_by=RunCommand))
end_output = "\nCommand end executed:"

View file

@ -927,7 +927,7 @@ Explanation: Take on one task, such as writing or rewriting a file. Upon complet
{
"command_name": "Engineer2.write_new_code",
"args": {
"path": "src/index.html"
"path": "/absolute/path/to/src/index.html"
}
},
{

View file

@ -97,7 +97,7 @@ class LineNumberError(Exception):
"search_dir",
"search_file",
"find_file",
"search_index_repo",
"similarity_search",
]
)
class Editor(BaseModel):
@ -811,7 +811,7 @@ class Editor(BaseModel):
context=context.strip(),
)
if mismatch_error:
return mismatch_error
raise ValueError(mismatch_error)
ret_str = self._edit_file_impl(
file_name,
start=first_replaced_line_number,