Skip to content

重构src/agent目录中的代码,减少其代码重复 #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hoare211
Copy link

@hoare211 hoare211 commented Jun 5, 2025

1.修改原因:src/agent目录中的agent的实现,代码几乎完全相同,存在严重的代码重复;各个agent对应的prompt模板,存在大量重复
2.修改内容:
(1). 代码:refactor(agent): 重构多个agent类继承自BaseAgent
将browser_use_agent、deep_analyzer_agent、deep_researcher_agent和planning_agent重构为继承自新创建的BaseAgent类,减少代码重复。BaseAgent类包含了这些agent共有的核心功能实现。
主要变更:
1). 创建BaseAgent基类包含共享逻辑
2). 简化各子类实现,仅保留特定配置
3). 统一初始化流程
(2). prompt模板
重构agent中的prompt模板
1).重构agent中的prompt模板,减少模板中的重复描述;
2).重构base_agent的模板加载逻辑,支持多目录搜索和jinja2渲染

@DVampire
Copy link
Collaborator

DVampire commented Jun 6, 2025

感谢您的帮助,我最近两天会测试一下,如果没有问题将合并到主分支

yufei311 added 2 commits June 14, 2025 22:21
将browser_use_agent、deep_analyzer_agent、deep_researcher_agent和planning_agent重构为继承自新创建的BaseAgent类,减少代码重复。BaseAgent类包含了这些agent共有的核心功能实现。

主要变更:
1. 创建BaseAgent基类包含共享逻辑
2. 简化各子类实现,仅保留特定配置
3. 统一初始化流程
4. 添加.gitignore忽略.idea目录
1).重构agent中的prompt模板,减少模板中的重复描述;
2).重构base_agent的模板加载逻辑,支持多目录搜索和jinja2渲染
@hoare211 hoare211 force-pushed the refactor/cleanup-duplicates-in-agent branch from eafce12 to 69aa017 Compare June 14, 2025 14:57
@hoare211
Copy link
Author

之前的代码修改有点问题,进行了修正。同时,基于jinia2的宏,重构了agent的yaml模版部分。在本地使用qwen3 14b做了测试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants