mirror of
https://github.com/yuruotong1/autoMate.git
synced 2026-03-22 13:07:17 +08:00
new
This commit is contained in:
BIN
agent/__pycache__/agent.cpython-39.pyc
Normal file
BIN
agent/__pycache__/agent.cpython-39.pyc
Normal file
Binary file not shown.
BIN
agent/__pycache__/agent_base.cpython-39.pyc
Normal file
BIN
agent/__pycache__/agent_base.cpython-39.pyc
Normal file
Binary file not shown.
BIN
agent/__pycache__/manager_agent.cpython-39.pyc
Normal file
BIN
agent/__pycache__/manager_agent.cpython-39.pyc
Normal file
Binary file not shown.
@@ -2,7 +2,7 @@ import openai
|
||||
import yaml
|
||||
|
||||
|
||||
class Agent:
|
||||
class AgentBase:
|
||||
def __init__(self, role):
|
||||
"""
|
||||
Initialize an Agent object.
|
||||
@@ -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))
|
||||
|
||||
@@ -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,向总经理汇报")
|
||||
|
||||
@@ -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,向总计划制定者汇报")
|
||||
|
||||
10
main.py
10
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)
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
work_principle/__pycache__/five_w_two_h.cpython-39.pyc
Normal file
BIN
work_principle/__pycache__/five_w_two_h.cpython-39.pyc
Normal file
Binary file not shown.
BIN
work_principle/__pycache__/okr_principle.cpython-39.pyc
Normal file
BIN
work_principle/__pycache__/okr_principle.cpython-39.pyc
Normal file
Binary file not shown.
@@ -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": "这个任务要做成什么程度"}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user