mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-07-08 16:12:16 +02:00
add deploy plan for da
This commit is contained in:
parent
03f69609d9
commit
445db9074b
4 changed files with 52 additions and 2 deletions
|
|
@ -154,3 +154,49 @@ class SimpleExpRetriever(ExpRetriever):
|
|||
|
||||
def retrieve(self, context: str = "") -> str:
|
||||
return self.EXAMPLE
|
||||
|
||||
|
||||
class KeywordExpRetriever(ExpRetriever):
|
||||
"""An experience retriever that returns examples based on keywords in the context."""
|
||||
|
||||
EXAMPLE: dict = {
|
||||
"deploy": """
|
||||
## example 1
|
||||
User Requirement: launch a service from workspace/web_snake_game/web_snake_game, and deploy it to public
|
||||
Explanation: Launching a service requires Terminal tool with daemon mode, write this into task instruction.
|
||||
```json
|
||||
[
|
||||
{
|
||||
"command_name": "append_task",
|
||||
"args": {
|
||||
"task_id": "1",
|
||||
"dependent_task_ids": [],
|
||||
"instruction": "Use the Terminal tool to launch the service in daemon mode",
|
||||
"assignee": "David"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_name": "append_task",
|
||||
"args": {
|
||||
"task_id": "2",
|
||||
"dependent_task_ids": ["1"],
|
||||
"instruction": "Test the service with a simple request",
|
||||
"assignee": "David"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command_name": "append_task",
|
||||
"args": {
|
||||
"task_id": "3",
|
||||
"dependent_task_ids": ["2"],
|
||||
"instruction": "Deploy the service to public",
|
||||
"assignee": "David"
|
||||
}
|
||||
},
|
||||
"""
|
||||
}
|
||||
|
||||
def retrieve(self, context: str) -> str:
|
||||
if "deploy" in context.lower():
|
||||
return self.EXAMPLE["deploy"]
|
||||
return ""
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ def prepare_command_prompt(commands: list[Command]) -> str:
|
|||
|
||||
|
||||
async def run_env_command(role: Role, cmd: list[dict], role_memory: Memory = None):
|
||||
assert isinstance(role.rc.env, MGXEnv), "TeamLeader should only be used in an MGXEnv"
|
||||
if not isinstance(role.rc.env, MGXEnv):
|
||||
return
|
||||
if cmd["command_name"] == Command.PUBLISH_MESSAGE.cmd_name:
|
||||
role.publish_message(Message(**cmd["args"]))
|
||||
if cmd["command_name"] == Command.ASK_HUMAN.cmd_name:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue