This commit is contained in:
yuruo
2024-01-20 11:00:36 +08:00
parent 20ab6b3965
commit 5b884378b1
4 changed files with 84 additions and 39 deletions

View File

@@ -16,8 +16,31 @@ autoMate定义了三种角色
# OKR工作体系
市面上的大模型是对任务理解不透彻如何解决这个问题呢我想到了OKR工作体系把上层的O向下拆解成KR并且中间不断对焦我认为这是一个非常高效的工作体系AutoMate 引入OKR就像是给整个团队配上了高级导航系统各agent都能清清楚楚知道自己要完成的任务同时不断与上级对焦能够避免任务失真。
大模型的回答内容缺少精准度,本质上是对任务理解不透彻如何解决这个问题呢我想到了OKR工作体系把上层的O向下拆解成KR并且中间不断对焦我认为这是一个非常高效的工作体系AutoMate 引入OKR就像是给整个团队配上了高级导航系统各agent都能清清楚楚知道自己要完成的任务同时不断与上级对焦能够避免任务失真。
在 o_kr.py 中定义了目标Objective并为每个目标关联多个关键成果Key Results用户可以通过实例化`OKR_Object`来创建一个目标,然后通过`add_key_result`方法添加关联的关键成果。每个关键成果的进度可以通过`set_progress`方法单独更新。目标的总体进度将根据其所有关键成果的进度自动更新,示例代码如下:
```python
from o_kr import OKR_Object, OKR_KeyResult
# 创建一个目标
objective = OKR_Object("提升品牌知名度")
# 创建关键成果并添加到目标中
kr1 = OKR_KeyResult("完成市场调研")
kr2 = OKR_KeyResult("开展线上营销活动")
objective.add_key_result(kr1)
objective.add_key_result(kr2)
# 更新关键成果的进度
kr1.set_progress(50)
kr2.set_progress(75)
# 打印目标的进度
print(objective.progress) # 输出应该是两个关键成果进度的平均值
```
# 工具
使用selenium工具操作浏览器进行网络搜索和内容爬取。
使用selenium工具操作浏览器进行网络搜索和内容爬取。

View File

@@ -1,12 +1,15 @@
from o_kr import OKR
class AutoMate:
def __init__(self):
pass
def rule_define(self):
pass
o_kr = OKR()
o_kr.set_objective(input("请输入任务: "))

54
o_kr.py Normal file
View File

@@ -0,0 +1,54 @@
from o_kr import OKR_KeyResult
class OKR_Object:
"""
Represents an objective in an Objectives and Key Results (OKR) tracker.
Attributes:
name (str): The name of the objective.
key_results (list): A list of KeyResult objects representing the key results of the objective.
progress (int): The progress of the objective, calculated based on the progress of its key results.
"""
def __init__(self, name):
self.name = name
self.key_results = []
self.progress = 0
def add_key_result(self, key_result:OKR_KeyResult):
self.key_results.append(key_result)
key_result.set_objective(self)
def update_progress(self):
key_results_progress = [kr.progress for kr in self.key_results]
if all(progress == 100 for progress in key_results_progress):
self.progress = 100
else:
self.progress = sum(key_results_progress) / len(key_results_progress)
class OKR_KeyResult:
"""
Represents a key result in an Objectives and Key Results (OKR) tracker.
Attributes:
name (str): The name of the key result.
progress (int): The progress of the key resultprogress is a number between 0 and 100.
Methods:
set_progress(progress): Updates the progress of the key result.
set_objective(objective): Sets the objective for the key result.
"""
def __init__(self, name):
self.name = name
self.progress = 0
self.objective = None
def set_objective(self, objective):
self.objective = objective
def set_progress(self, progress):
self.progress = progress
if self.objective:
self.objective.update_progress()

View File

@@ -1,35 +0,0 @@
class OKR:
"""
Represents an Objectives and Key Results (OKR) tracker.
Attributes:
objectives (dict): A dictionary to store the objectives and their progress.
key_results (dict): A dictionary to store the key results for each objective.
Methods:
set_objective(objective): Sets a new objective with initial progress of 0.
set_key_result(objective, key_result): Sets a new key result for the given objective.
set_objective_progress(objective, progress): Updates the progress of the given objective.
set_key_result_progress(objective, key_result, progress): Updates the progress of the given key result.
"""
def __init__(self):
self.objectives = {}
self.key_results = {}
def set_objective(self, objective):
self.objectives[objective] = 0
def set_key_result(self, objective, key_result):
if objective in self.objectives:
if objective not in self.key_results:
self.key_results[objective] = []
self.key_results[objective].append(key_result)
def set_objective_progress(self, objective, progress):
if objective in self.objectives:
self.objectives[objective] = progress
def set_key_result_progress(self, objective, key_result, progress):
if objective in self.key_results and key_result in self.key_results[objective]:
self.key_results[objective][key_result] = progress