diff --git a/agent/plan_agent.py b/agent/plan_agent.py index c52028e..76ef447 100644 --- a/agent/plan_agent.py +++ b/agent/plan_agent.py @@ -6,15 +6,16 @@ from work_principle.okr_principle import OKR_Object class PlanAgent(AgentBase): def __init__(self): self.logger = logging.getLogger(__name__) - super().__init__('你是一名计划拆解者,利用工具将object拆解成key_result,请你返回json格式的内容,比如[{"tools_name":"web_browser","param":"工具a"}]') + super().__init__('你是一名计划拆解者,挑选工具列表中合适的工具将object拆解成key_result然后自动填充参数,建议拆解成多个key_result,' + + '多个key_result完成这一个目标,返回格式如下:[{"tools_name":"web_browser","request_param":"请求参数"}]') # 根据object和已有的工具能力拆解成key result,key def aligning(self, okr_object: OKR_Object): raw = okr_object.raw_user_task tools_list = [i().get_info() for i in self.get_subclasses(ToolsBase)] r = self.call_gpt(f"object为'{raw}', 工具列表为{tools_list}") - print(r) self.logger.info(f"Alignment result: {r}") + # return r def get_subclasses(self, cls): subclasses = [] diff --git a/main.py b/main.py index 82f90d7..1eb19d1 100644 --- a/main.py +++ b/main.py @@ -16,7 +16,7 @@ class AutoMate: while True: o_kr = OKR_Object("因为想要增加编程效率,对比一下copilot和curson谁更好用,比较提示词数量、安装易用性,给出不少于100字的文章") ManagerAgent().optimization_Object(o_kr) - r = input(f"最终对齐的任务是:{o_kr.raw_user_task},一切都OK对吧?y/n") + r = input(f"最终对齐的任务是:{o_kr.raw_user_task},一切都OK对吧?y/n\n") if r == "y": break diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..71eb93c --- /dev/null +++ b/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +log_cli = True +log_cli_level = info +log_cli_format = %(asctime)s [%(levelname)s] | %(filename)s:%(lineno)s | %(message)s +log_cli_date_format = %Y-%m-%d %H:%M:%S \ No newline at end of file diff --git a/tests/pytest.in b/tests/pytest.in new file mode 100644 index 0000000..c46b699 --- /dev/null +++ b/tests/pytest.in @@ -0,0 +1,3 @@ +[pytest] +log_cli = True +log_cli_level = info \ No newline at end of file diff --git a/tests/test_plan_agent.py b/tests/test_plan_agent.py new file mode 100644 index 0000000..33f255e --- /dev/null +++ b/tests/test_plan_agent.py @@ -0,0 +1,15 @@ +import unittest + +from agent.plan_agent import PlanAgent +from work_principle.okr_principle import OKR_Object +class TestPlanAgent(unittest.TestCase): + def test_aligning(self): + # Create an instance of the PlanAgent class + plan_agent = PlanAgent() + # Create a mock OKR_Object with a raw_user_task + okr_object = OKR_Object("因为想要增加编程效率,对比一下copilot和curson谁更好用,比较提示词数量、安装易用性,给出不少于100字的文") + # Call the aligning method + plan_agent.aligning(okr_object) + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/tools/init.py b/tools/init.py new file mode 100644 index 0000000..c974eaa --- /dev/null +++ b/tools/init.py @@ -0,0 +1,3 @@ +from llm_tools import LLMTools +from web_browser_element_tools import WebBrowserElement +from web_browser_url_tools import WebBrowserUrl \ No newline at end of file