-
Notifications
You must be signed in to change notification settings - Fork 17
fix(motion-graphics): correct FileTools import path + constructor (v0.2.25) #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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |||||||||
|
|
||||||||||
| try: | ||||||||||
| from praisonaiagents import Agent | ||||||||||
| from praisonaiagents.tools import FileTools | ||||||||||
| from praisonaiagents.tools.file_tools import FileTools | ||||||||||
| except ImportError: | ||||||||||
| # Fallback for development | ||||||||||
| Agent = None | ||||||||||
|
|
@@ -193,8 +193,10 @@ def create_motion_graphics_agent( | |||||||||
| Workspace directory: {workspace} | ||||||||||
| """ | ||||||||||
|
|
||||||||||
| # Create tools | ||||||||||
| file_tools = FileTools(base_dir=str(workspace)) | ||||||||||
| # Create tools. | ||||||||||
| # FileTools is a utility class with bound methods; pass the instance so the | ||||||||||
| # Agent can register read_file/write_file/list_files as callable tools. | ||||||||||
| file_tools = FileTools() | ||||||||||
|
||||||||||
| file_tools = FileTools() | |
| file_tools = FileTools() | |
| if hasattr(file_tools, "base_dir"): | |
| file_tools.base_dir = str(workspace) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,9 +6,11 @@ | |||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||
| from praisonaiagents import Agent, AgentTeam | ||||||||||||||||||||||||||||||
| from praisonaiagents.tools import FileTools, search_web | ||||||||||||||||||||||||||||||
| except ImportError: | ||||||||||||||||||||||||||||||
| # Fallback for development | ||||||||||||||||||||||||||||||
| from praisonaiagents.tools.file_tools import FileTools | ||||||||||||||||||||||||||||||
| # search_web is lazily resolved via praisonaiagents.tools.__getattr__ | ||||||||||||||||||||||||||||||
| from praisonaiagents.tools import search_web | ||||||||||||||||||||||||||||||
| except (ImportError, AttributeError): | ||||||||||||||||||||||||||||||
| # Fallback for development / partial installs | ||||||||||||||||||||||||||||||
|
Comment on lines
7
to
+13
|
||||||||||||||||||||||||||||||
| Agent = None | ||||||||||||||||||||||||||||||
| AgentTeam = None | ||||||||||||||||||||||||||||||
| FileTools = None | ||||||||||||||||||||||||||||||
|
Comment on lines
+9
to
16
|
||||||||||||||||||||||||||||||
| from praisonaiagents.tools.file_tools import FileTools | |
| # search_web is lazily resolved via praisonaiagents.tools.__getattr__ | |
| from praisonaiagents.tools import search_web | |
| except (ImportError, AttributeError): | |
| # Fallback for development / partial installs | |
| Agent = None | |
| AgentTeam = None | |
| FileTools = None | |
| # search_web is lazily resolved via praisonaiagents.tools.__getattr__ | |
| from praisonaiagents.tools import search_web | |
| except (ImportError, AttributeError): | |
| # Fallback for development / partial installs | |
| Agent = None | |
| AgentTeam = None |
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.
Since
FileToolsno longer accepts abase_dirin its constructor, it likely defaults to the current working directory for file operations. This poses a risk if the process CWD differs from the intendedworkspace(which is often a temporary directory), as the agent might write files where theRenderTools(which uses theworkspacepath) cannot find them. Adding an explicit instruction to the agent to use absolute paths within the workspace helps ensure consistency.