diff --git a/agent/__pycache__/manager_agent.cpython-39.pyc b/agent/__pycache__/manager_agent.cpython-39.pyc index f658ad2..4c3c9eb 100644 Binary files a/agent/__pycache__/manager_agent.cpython-39.pyc and b/agent/__pycache__/manager_agent.cpython-39.pyc differ diff --git a/agent/manager_agent.py b/agent/manager_agent.py index 4cc7c8c..dcd9b67 100644 --- a/agent/manager_agent.py +++ b/agent/manager_agent.py @@ -12,16 +12,15 @@ class ManagerAgent(AgentBase): # todo 待加入 PDCA循环规则 # 利用 smart 原则对目标进行评估 - for k,i in object.five_w_two_h.content.items(): - r = {'是否具备': 'no'} + for i in object.five_w_two_h.content: content = object.content - while r["是否具备"]=="no" : - prompt = f"这是一个任务描述:'{content}'。你觉得这个任务描述具备{i['descriptions']}吗?如果具备返回格式如下:{{'是否具备': 'yes'}},如果不具备返回格式如下:{{'是否具备': 'no', '原因': '返回具体原因即可'}}" + call_openai_res = {'isOk': 'no', 'content': ''} + while call_openai_res["isOk"]=="no" : + prompt = f"这是一个任务描述:'{content}'。你觉得这个任务描述具备{i['descriptions']}吗?如果具备返回格式如下:{{\"isOk\":\"yes\", \"content\":\"提炼出任务的{i['descriptions']}\"}},如果不具备返回格式如下:{{\"isOk\":\"no\",\"content\":\"返回不具备的原因并给出完善建议\"}}" 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 + call_openai_res = json.loads(self.call_gpt(prompt)) + self.logger.info(call_openai_res) + if call_openai_res["isOk"]=="no": + content = content + f",{i['target']}:" +input(f"【警告】{call_openai_res['content']}\n请您补充信息:") + i['content'] = call_openai_res["content"] self.logger.info(str(object.five_w_two_h.content)) diff --git a/main.py b/main.py index 8b99bd0..7fc986f 100644 --- a/main.py +++ b/main.py @@ -9,7 +9,7 @@ class AutoMate: def rule_define(self): # o_kr = OKR_Object(input("请输入任务: ")) - o_kr = OKR_Object("对比一下copilot和curson谁更好用") + o_kr = OKR_Object("对比一下copilot和curson谁更好用,比较提示词数量、安装易用性,给出不少于100字的文章") 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 index 8f8a012..400483d 100644 Binary files a/work_principle/__pycache__/five_w_two_h.cpython-39.pyc and b/work_principle/__pycache__/five_w_two_h.cpython-39.pyc differ diff --git a/work_principle/five_w_two_h.py b/work_principle/five_w_two_h.py index 381f80a..bacc840 100644 --- a/work_principle/five_w_two_h.py +++ b/work_principle/five_w_two_h.py @@ -1,8 +1,9 @@ class FiveWTwoH: def __init__(self) -> None: - self.content = { - "what": {"content": "", "descriptions": "任务主体、动作、数量"}, - "why": {"content": "", "descriptions": "为什么要做这个任务"}, + self.content = [ + {"target": "任务主体", "content": "", "descriptions": "任务主体"}, + {"target": "执行动作", "content": "", "descriptions": "执行动作"}, + {"target": "任务背景", "content": "", "descriptions": "任务背景或原因"}, # "how": {"content": "", "descriptions": "这个任务如何做", "example": ["通过线上直播发布会,合作伙伴渠道和社交媒体宣传", "通过增加人员、改善流程和引入新的服务软件"]}, - "how_much": {"content": "", "descriptions": "这个任务要做成什么程度"} - } + {"target": "任务完成程度", "content": "", "descriptions": "任务要做到什么程度,给出具体的几个要求"} + ]