mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-30 11:26:23 +02:00
fix conflict
This commit is contained in:
commit
4975baa890
110 changed files with 950 additions and 248 deletions
|
|
@ -6,8 +6,8 @@
|
|||
@File : architect.py
|
||||
"""
|
||||
|
||||
from metagpt.actions import WriteDesign, WritePRD
|
||||
from metagpt.roles import Role
|
||||
from metagpt.actions import WriteDesign, WritePRD, DesignFilenames
|
||||
|
||||
|
||||
class Architect(Role):
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
@File : sales.py
|
||||
"""
|
||||
from metagpt.roles import Sales
|
||||
|
||||
# from metagpt.actions import SearchAndSummarize
|
||||
# from metagpt.tools import SearchEngineType
|
||||
|
||||
|
|
@ -21,6 +22,7 @@ DESC = """
|
|||
|
||||
"""
|
||||
|
||||
|
||||
class CustomerService(Sales):
|
||||
def __init__(
|
||||
self,
|
||||
|
|
@ -30,4 +32,3 @@ class CustomerService(Sales):
|
|||
store=None
|
||||
):
|
||||
super().__init__(name, profile, desc=desc, store=store)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,8 @@
|
|||
@File : engineer.py
|
||||
"""
|
||||
import asyncio
|
||||
import re
|
||||
import ast
|
||||
import shutil
|
||||
from collections import OrderedDict
|
||||
from pathlib import Path
|
||||
|
||||
from metagpt.const import WORKSPACE_ROOT
|
||||
|
|
@ -17,7 +16,6 @@ from metagpt.roles import Role
|
|||
from metagpt.actions import WriteCode, WriteCodeReview, WriteTasks, WriteDesign
|
||||
from metagpt.schema import Message
|
||||
from metagpt.utils.common import CodeParser
|
||||
from collections import OrderedDict
|
||||
|
||||
|
||||
async def gather_ordered_k(coros, k) -> list:
|
||||
|
|
@ -115,7 +113,7 @@ class Engineer(Role):
|
|||
|
||||
rsps = await gather_ordered_k(todo_coros, self.n_borg)
|
||||
for todo, code_rsp in zip(self.todos, rsps):
|
||||
code = self.parse_code(code_rsp)
|
||||
_ = self.parse_code(code_rsp)
|
||||
logger.info(todo)
|
||||
logger.info(code_rsp)
|
||||
# self.write_file(todo, code)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@
|
|||
@Author : alexanderwu
|
||||
@File : product_manager.py
|
||||
"""
|
||||
from metagpt.actions import BossRequirement, WritePRD
|
||||
from metagpt.roles import Role
|
||||
from metagpt.actions import WritePRD, BossRequirement
|
||||
from metagpt.schema import Message
|
||||
|
||||
|
||||
class ProductManager(Role):
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
@Author : alexanderwu
|
||||
@File : project_manager.py
|
||||
"""
|
||||
from metagpt.actions import WriteDesign, WriteTasks
|
||||
from metagpt.roles import Role
|
||||
from metagpt.actions import WriteTasks, AssignTasks, WriteDesign
|
||||
|
||||
|
||||
class ProjectManager(Role):
|
||||
|
|
|
|||
|
|
@ -44,4 +44,3 @@ class PromptString(Enum):
|
|||
HAS_HAPPENED = "给出以下角色的观察和他们正在等待的事情的描述,说明角色是否已经见证了这个事件。\n{format_instructions}\n\n示例:\n\n观察:\nJoe在2023-05-04 08:00:00+00:00走进办公室\nJoe在2023-05-04 08:05:00+00:00对Sally说hi\nSally在2023-05-04 08:05:30+00:00对Joe说hello\nRebecca在2023-05-04 08:10:00+00:00开始工作\nJoe在2023-05-04 08:15:00+00:00做了一些早餐\n\n等待:Sally回应了Joe\n\n 你的回应:'{{\"has_happened\": true, \"date_occured\": 2023-05-04 08:05:30+00:00}}'\n\n让我们开始吧!\n\n观察:\n{memory_descriptions}\n\n等待:{event_description}\n"
|
||||
|
||||
OUTPUT_FORMAT = "\n\n(记住!确保你的输出总是符合以下两种格式之一:\n\nA. 如果你已经完成了任务:\n思考:'我已经完成了任务'\n最终回应:<str>\n\nB. 如果你还没有完成任务:\n思考:<str>\n行动:<str>\n行动输入:<str>\n观察:<str>)\n"
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
@Author : alexanderwu
|
||||
@File : qa_engineer.py
|
||||
"""
|
||||
from metagpt.actions.run_code import RunCode
|
||||
from metagpt.actions import WriteTest
|
||||
from metagpt.roles import Role
|
||||
|
||||
|
|
|
|||
|
|
@ -6,17 +6,17 @@
|
|||
@File : role.py
|
||||
"""
|
||||
from __future__ import annotations
|
||||
from typing import Type, Iterable
|
||||
|
||||
from typing import Iterable, Type
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from metagpt.logs import logger
|
||||
|
||||
# from metagpt.environment import Environment
|
||||
from metagpt.actions import Action, ActionOutput
|
||||
from metagpt.llm import LLM
|
||||
from metagpt.schema import Message
|
||||
from metagpt.logs import logger
|
||||
from metagpt.memory import Memory
|
||||
from metagpt.schema import Message
|
||||
|
||||
PREFIX_TEMPLATE = """You are a {profile}, named {name}, your goal is {goal}, and the constraint is {constraints}. """
|
||||
|
||||
|
|
@ -114,6 +114,7 @@ class Role:
|
|||
def _set_state(self, state):
|
||||
"""Update the current state."""
|
||||
self._rc.state = state
|
||||
logger.debug(self._actions)
|
||||
self._rc.todo = self._actions[self._rc.state]
|
||||
|
||||
def set_env(self, env: 'Environment'):
|
||||
|
|
@ -170,8 +171,11 @@ class Role:
|
|||
if not self._rc.env:
|
||||
return 0
|
||||
env_msgs = self._rc.env.memory.get()
|
||||
|
||||
observed = self._rc.env.memory.get_by_actions(self._rc.watch)
|
||||
|
||||
already_observed = self._rc.memory.get()
|
||||
|
||||
news: list[Message] = []
|
||||
for i in observed:
|
||||
if i in already_observed:
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
@Author : alexanderwu
|
||||
@File : sales.py
|
||||
"""
|
||||
from metagpt.roles import Role
|
||||
from metagpt.actions import SearchAndSummarize
|
||||
from metagpt.roles import Role
|
||||
from metagpt.tools import SearchEngineType
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,18 +5,18 @@
|
|||
@Author : alexanderwu
|
||||
@File : seacher.py
|
||||
"""
|
||||
from metagpt.actions import ActionOutput, SearchAndSummarize
|
||||
from metagpt.logs import logger
|
||||
|
||||
from metagpt.roles import Role
|
||||
from metagpt.actions import SearchAndSummarize, ActionOutput
|
||||
from metagpt.tools import SearchEngineType
|
||||
from metagpt.schema import Message
|
||||
from metagpt.tools import SearchEngineType
|
||||
|
||||
|
||||
class Searcher(Role):
|
||||
def __init__(self, name='Alice', profile='Smart Assistant', goal='Provide search services for users',
|
||||
constraints='Answer is rich and complete', engine=SearchEngineType.SERPAPI_GOOGLE, **kwargs):
|
||||
super().__init__(name, profile, goal, constraints, **kwargs)
|
||||
self._init_actions([SearchAndSummarize(engine = engine)])
|
||||
self._init_actions([SearchAndSummarize(engine=engine)])
|
||||
|
||||
def set_search_func(self, search_func):
|
||||
action = SearchAndSummarize("", engine=SearchEngineType.CUSTOM_ENGINE, search_func=search_func)
|
||||
|
|
@ -34,4 +34,4 @@ class Searcher(Role):
|
|||
self._rc.memory.add(msg)
|
||||
|
||||
async def _act(self) -> Message:
|
||||
return await self._act_sp()
|
||||
return await self._act_sp()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue