Skip to content

Commit d1c6596

Browse files
authored
Merge pull request #1750 from seehi/feat-random-project-name
Project name with timestamp
2 parents cf761ab + feec34c commit d1c6596

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

metagpt/prompts/di/engineer2.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import time
2+
13
from metagpt.const import REACT_TEMPLATE_PATH, VUE_TEMPLATE_PATH
24
from metagpt.prompts.di.role_zero import ROLE_INSTRUCTION
35

@@ -34,7 +36,7 @@
3436
11.1 Do not use Editor.insert_content_at_line or Editor.edit_file_by_replace more than once per command list.
3537
12. If you choose Editor.insert_content_at_line, you must ensure that there is no duplication between the inserted content and the original code. If there is overlap between the new code and the original code, use Editor.edit_file_by_replace instead.
3638
13. If you choose Editor.edit_file_by_replace, the original code that needs to be replaced must start at the beginning of the line and end at the end of the line
37-
14. When not specified, you should write files in a folder named "{{project_name}}". The project name is the name of the project which meets the user's requirements.
39+
14. When not specified, you should write files in a folder named "{{project_name}}_{timestamp}". The project name is the name of the project which meets the user's requirements.
3840
15. When provided system design or project schedule, you MUST read them first before making a plan, then adhere to them in your implementation, especially in the programming language, package, or framework. You MUST implement all code files prescribed in the system design or project schedule.
3941
16. When planning, initially list the files for coding, then outline all coding tasks based on the file organization in your first response.
4042
17. If you plan to read a file, do not include other plans in the same response.
@@ -47,10 +49,10 @@
4749
24. The priority to select technology stacks: Describe in Sytem Design and Project Schedule > Vite, React, MUI and Tailwind CSS > native HTML
4850
24.1. The React template is in the "{react_template_path}" and Vue template is in the "{vue_template_path}".
4951
25. If use Vite, Vue/React, MUI, and Tailwind CSS as the programming language or no programming language is specified in document or user requirement, follow these steps:
50-
25.1. Create the project folder if no exists. Use cmd " mkdir -p {{project_name}} "
51-
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 ". This must be a single response without other commands.
52+
25.1. Create the project folder if no exists. Use cmd " mkdir -p {{project_name}}_{timestamp} "
53+
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}}_{timestamp}/ && cd {{workspace}}/{{project_name}}_{timestamp} && pwd && tree ". This must be a single response without other commands.
5254
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.
53-
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}}.
55+
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}}_{timestamp}.
5456
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.
5557
26. Engineer2.write_new_code is used to write or rewrite the code, which will modify the whole file. Editor.edit_file_by_replace is used to edit a small part of the file.
5658
27. Deploye the project to the public after you install and build the project, there will be a folder named "dist" in the current directory after the build.
@@ -59,6 +61,7 @@
5961
""".format(
6062
vue_template_path=VUE_TEMPLATE_PATH.resolve().absolute(),
6163
react_template_path=REACT_TEMPLATE_PATH.resolve().absolute(),
64+
timestamp=int(time.time()),
6265
)
6366
CURRENT_STATE = """
6467
The current editor state is:

metagpt/utils/token_counter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
"openai/o1-preview": {"prompt": 0.015, "completion": 0.06},
9494
"openai/o1-mini": {"prompt": 0.003, "completion": 0.012},
9595
"anthropic/claude-3-opus": {"prompt": 0.015, "completion": 0.075},
96-
"anthropic/claude-3.5-sonnet": {"prompt": 0.003, "completion": 0.015},
9796
"anthropic/claude-3.7-sonnet": {"prompt": 0.003, "completion": 0.015},
9897
"anthropic/claude-3.7-sonnet:beta": {"prompt": 0.003, "completion": 0.015},
9998
"anthropic/claude-3.7-sonnet:thinking": {"prompt": 0.003, "completion": 0.015},

0 commit comments

Comments
 (0)