-
Notifications
You must be signed in to change notification settings - Fork 6.6k
add PPTMaker #1830
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
Rubbisheep
wants to merge
4
commits into
FoundationAgents:main
Choose a base branch
from
Rubbisheep:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
add PPTMaker #1830
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stellaHSR
reviewed
May 16, 2025
stellaHSR
reviewed
May 16, 2025
metagpt/roles/PPTmaker.py
Outdated
|
||
self.curr_step += 1 | ||
return Message(content=self.optimized_result or message_content, role=self.profile, cause_by=tool_class) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest making the code more concise and maintainable by simplifying its structure and improving readability. For example:
async def react(self) -> Message:
"""Process current state, decide next action, execute and return a Message."""
available_tools = {
"latexgenerator": (LatexGeneratorAction, True), # (工具类, 是否保存结果)
"validator": (ValidatorAction, False)
}
tool_name = list(available_tools.keys())[self.curr_step % len(available_tools)]
tool_class, save_result = available_tools[tool_name]
tool = tool_class()
try:
result = await tool.run(
request=self.rc.history[0].content,
history=self.rc.history
)
if save_result:
self.optimized_result = result
self.rc.memory.add(result)
if isinstance(tool, ValidatorAction) and "No further feedback" in result:
self.is_completed = True
return Message(content=self.optimized_result, role=self.profile, cause_by=tool_class)
except Exception as e:
logger.error(f"Error executing {tool_name}: {e}")
self.curr_step += 1
return Message(
content=self.optimized_result or f"Step {self.curr_step}/{self.max_steps}: {tool_name}",
role=self.profile,
cause_by=tool_class
)```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
功能概述
添加了新的
PPTMaker
角色,能够生成基于 LaTeX Beamer 的演示文稿。PPTMaker
通过协调LatexGeneratorAction
和ValidatorAction
两个 Action,实现了一个迭代式生成-验证流程,能够逐步构建并优化 LaTeX 演示文稿内容。主要特性
实现细节
LatexGeneratorAction
和ValidatorAction
PPTMaker
角色类,继承自RoleZero
metagpt.prompts.PPTmaker
模块使用示例
计划改进
相关文件