Update prompt in write_code_guide_an.py.

This commit is contained in:
mannaandpoem 2023-12-27 14:29:01 +08:00
parent d47cc0448f
commit e65f16741c

View file

@ -7,21 +7,19 @@
"""
import asyncio
from metagpt.actions.action_node import ActionNode
from pydantic import Field
from metagpt.actions.action import Action
from metagpt.actions.action_node import ActionNode
from metagpt.llm import LLM
from metagpt.provider.base_gpt_api import BaseGPTAPI
from metagpt.schema import Document
GUIDELINE = ActionNode(
key="Code Guideline",
expected_type=list[str],
instruction="You are a professional software engineer, and your main task is to "
"proposing incremental development plans and code guidance",
"proposing incremental development plans and code guidance",
example=[
"`calculator.py` should be extended to include methods for subtraction, multiplication, and division. Error handling should be implemented for division to prevent division by zero.",
"New endpoints for subtraction, multiplication, and division should be added to `main.py`.",
@ -80,10 +78,9 @@ def divide_numbers():
return jsonify({'result': result}), 200
if __name__ == '__main__':
app.run()
```"""
```""",
)
CODE_GUIDE_CONTEXT = """
### NOTICE
Role: You are a professional software engineer, and your main task is to write code Guideline and code craft with triple quote, based on the following attentions and context. Output format carefully referenced "Format example".
@ -198,16 +195,10 @@ class Calculator:
return num1 + num2
"""
GUIDE_NODES = [
GUIDELINE,
INCREMENTAL_CHANGE
]
GUIDE_NODES = [GUIDELINE, INCREMENTAL_CHANGE]
WRITE_CODE_GUIDE_NODE = ActionNode.from_children("WriteCodeGuide", GUIDE_NODES)
# 1. 对最后的全部代码进行review一次或者测试
# 2. 将user requirement也作为write code的输入
# 3. 对前置的action进行重新设计
class WriteCodeGuide(Action):
name: str = "WriteCodeGuide"