add deploy plan for da

This commit is contained in:
yzlin 2024-05-08 15:18:26 +08:00
parent 03f69609d9
commit 445db9074b
4 changed files with 52 additions and 2 deletions

View file

@ -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 ""

View file

@ -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: