This commit is contained in:
yuruo
2024-01-20 18:51:28 +08:00
parent cebce211eb
commit 83d7bda8a9
5 changed files with 16 additions and 16 deletions

View File

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

View File

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

View File

@@ -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": "任务要做什么程度,给出具体的几个要求"}
]