diff --git a/agent/__pycache__/agent.cpython-39.pyc b/agent/__pycache__/agent.cpython-39.pyc new file mode 100644 index 0000000..b9aa568 Binary files /dev/null and b/agent/__pycache__/agent.cpython-39.pyc differ diff --git a/agent/__pycache__/agent_base.cpython-39.pyc b/agent/__pycache__/agent_base.cpython-39.pyc new file mode 100644 index 0000000..4c3de5d Binary files /dev/null and b/agent/__pycache__/agent_base.cpython-39.pyc differ diff --git a/agent/__pycache__/manager_agent.cpython-39.pyc b/agent/__pycache__/manager_agent.cpython-39.pyc new file mode 100644 index 0000000..f658ad2 Binary files /dev/null and b/agent/__pycache__/manager_agent.cpython-39.pyc differ diff --git a/agent/agent.py b/agent/agent_base.py similarity index 98% rename from agent/agent.py rename to agent/agent_base.py index 2e44ea0..55daf03 100644 --- a/agent/agent.py +++ b/agent/agent_base.py @@ -2,7 +2,7 @@ import openai import yaml -class Agent: +class AgentBase: def __init__(self, role): """ Initialize an Agent object. diff --git a/agent/manager_agent.py b/agent/manager_agent.py index 0f63727..4cc7c8c 100644 --- a/agent/manager_agent.py +++ b/agent/manager_agent.py @@ -1,24 +1,27 @@ -from agent.agent import Agent +import json +from agent.agent_base import AgentBase from work_principle.okr_principle import OKR_Object - -class ManagerAgent(Agent): +import logging +logging.basicConfig(level=logging.INFO) +class ManagerAgent(AgentBase): def __init__(self): super().__init__("你是一名总经理,负责对任务进行可量化的评估") + self.logger = logging.getLogger(__name__) - def optimization_Object(self, object:OKR_Object): - object.content # todo 待加入 PDCA循环规则 # 利用 smart 原则对目标进行评估 - for i in object.five_w_two_h.content: - r = self.call_gpt(f"你觉得'{object.content}',说清楚了{i['descriptions']}吗?如果说清楚,返回{i}否则返回'no'") - if r == "no": - input(f"请说清楚'{object.content}'的{i},按回车键继续") - else: - i['content'] = r - - - - for k, v in object.smart.items(): - self.call_gpt(f"你觉得'{object.content}'这个目标,就{k}来说满分是3分可以打几分,只返回给1或2或3,比如2") + for k,i in object.five_w_two_h.content.items(): + r = {'是否具备': 'no'} + content = object.content + while r["是否具备"]=="no" : + prompt = f"这是一个任务描述:'{content}'。你觉得这个任务描述具备{i['descriptions']}吗?如果具备返回格式如下:{{'是否具备': 'yes'}},如果不具备返回格式如下:{{'是否具备': 'no', '原因': '返回具体原因即可'}}" + self.logger.info(prompt) + call_openai = self.call_gpt(prompt) + self.logger.info(call_openai) + r = json.loads(call_openai) + if r["是否具备"]=="no": + content = input(f"您的任务描述不清楚,{r['原因']}:") + i['content'] = content + self.logger.info(str(object.five_w_two_h.content)) diff --git a/agent/plan_agent.py b/agent/plan_agent.py index e89d280..bd41575 100644 --- a/agent/plan_agent.py +++ b/agent/plan_agent.py @@ -1,5 +1,5 @@ -from agent.agent import Agent +from agent.agent_base import AgentBase -class WokerAgent(Agent): +class WokerAgent(AgentBase): def __init__(self): super().__init__("你是一名计划拆解者,负责对OKR中的O进行拆解并制定KR,向总经理汇报") diff --git a/agent/woker_agent.py b/agent/woker_agent.py index d18255d..f526b04 100644 --- a/agent/woker_agent.py +++ b/agent/woker_agent.py @@ -1,5 +1,5 @@ -from agent.agent import Agent +from agent.agent_base import AgentBase -class WokerAgent(Agent): +class WokerAgent(AgentBase): def __init__(self): super().__init__("你是一名工作者,负责执行OKR中的KR,向总计划制定者汇报") diff --git a/main.py b/main.py index 100b43d..8b99bd0 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,5 @@ - from agent.manager_agent import ManagerAgent -from work_principle.okr_principle import OKR +from work_principle.okr_principle import OKR_Object class AutoMate: @@ -9,10 +8,9 @@ class AutoMate: def rule_define(self): - o_kr = OKR() - o_kr.set_objective(input("请输入任务: ")) - ManagerAgent().call_gpt(o_kr) - + # o_kr = OKR_Object(input("请输入任务: ")) + o_kr = OKR_Object("对比一下copilot和curson谁更好用") + ManagerAgent().optimization_Object(o_kr) diff --git a/work_principle/__pycache__/five_w_two_h.cpython-39.pyc b/work_principle/__pycache__/five_w_two_h.cpython-39.pyc new file mode 100644 index 0000000..8f8a012 Binary files /dev/null and b/work_principle/__pycache__/five_w_two_h.cpython-39.pyc differ diff --git a/work_principle/__pycache__/okr_principle.cpython-39.pyc b/work_principle/__pycache__/okr_principle.cpython-39.pyc new file mode 100644 index 0000000..b3d47e2 Binary files /dev/null and b/work_principle/__pycache__/okr_principle.cpython-39.pyc differ diff --git a/work_principle/five_w_two_h.py b/work_principle/five_w_two_h.py index d0231e4..381f80a 100644 --- a/work_principle/five_w_two_h.py +++ b/work_principle/five_w_two_h.py @@ -1,11 +1,8 @@ class FiveWTwoH: def __init__(self) -> None: self.content = { - "who": {"content": "", "descriptions": "谁来做这个任务"}, - "what": {"content": "", "descriptions": "这个任务是什么"}, - "when": {"content": "", "descriptions": "什么时候完成这个任务"}, - "where": {"content": "", "descriptions": "在哪里做这个任务"}, + "what": {"content": "", "descriptions": "任务主体、动作、数量"}, "why": {"content": "", "descriptions": "为什么要做这个任务"}, - "how": {"content": "", "descriptions": "这个任务如何做"}, + # "how": {"content": "", "descriptions": "这个任务如何做", "example": ["通过线上直播发布会,合作伙伴渠道和社交媒体宣传", "通过增加人员、改善流程和引入新的服务软件"]}, "how_much": {"content": "", "descriptions": "这个任务要做成什么程度"} - } \ No newline at end of file + } diff --git a/work_principle/okr_principle.py b/work_principle/okr_principle.py index 2304b64..07a498c 100644 --- a/work_principle/okr_principle.py +++ b/work_principle/okr_principle.py @@ -1,13 +1,14 @@ -from work_principle.okr_principle import OKR_KeyResult from work_principle.five_w_two_h import FiveWTwoH + class OKR_Object: + def __init__(self, content): self.content = content self.key_results = [] self.progress = 0 self.five_w_two_h = FiveWTwoH() - def add_key_result(self, key_result:OKR_KeyResult): + def add_key_result(self, key_result): self.key_results.append(key_result) key_result.set_objective(self)