🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
fix: som screenshot bugs (#2849)
Puzhen Zhang7ca699aa299e
diff --git a/camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit.py b/camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit.pyindex 176e83e04..f9a49f219 100644--- a/camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit.py+++ b/camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit.py@@ -1461,6 +1461,7 @@ class HybridBrowserToolkit(BaseToolkit):from camel.utils.tool_result import ToolResult+ os.makedirs(self._cache_dir, exist_ok=True)# Get screenshot and analysispage = await self._require_page()@@ -1539,14 +1540,12 @@ class HybridBrowserToolkit(BaseToolkit):analysis = await self._get_unified_analysis()elements = analysis.get("elements", {})if ref not in elements:- available_refs = list(elements.keys())logger.error(f"Error: Element reference '{ref}' not found. ")# Added snapshot to give more context on failuresnapshot = self._format_snapshot_from_analysis(analysis)tab_info = await self._get_tab_info_for_output()return {- "result": f"Error: Element reference '{ref}' not found. "- f"Available refs: {available_refs}",+ "result": f"Error: Element reference '{ref}' not found. ","snapshot": snapshot,**tab_info,}diff --git a/camel/toolkits/hybrid_browser_toolkit/unified_analyzer.js b/camel/toolkits/hybrid_browser_toolkit/unified_analyzer.jsindex 7c79e1043..85ab2510f 100644--- a/camel/toolkits/hybrid_browser_toolkit/unified_analyzer.js+++ b/camel/toolkits/hybrid_browser_toolkit/unified_analyzer.js@@ -735,11 +735,11 @@function renderTree(node, indent = '') {const lines = [];let meaningfulProps = '';- if (node.disabled) meaningfulProps += ' disabled';- if (node.occluded) meaningfulProps += ' occluded';+ if (node.disabled) meaningfulProps += ' [disabled]';+ if (node.occluded) meaningfulProps += ' [occluded]';if (node.checked !== undefined) meaningfulProps += ` checked=${node.checked}`;if (node.expanded !== undefined) meaningfulProps += ` expanded=${node.expanded}`;- if (node.selected) meaningfulProps += ' selected';+ if (node.selected) meaningfulProps += ' [selected]';// Add level attribute following Playwright's formatif (node.level !== undefined) meaningfulProps += ` [level=${node.level}]`;diff --git a/camel/toolkits/search_toolkit.py b/camel/toolkits/search_toolkit.pyindex 6fe624421..f7ff30e07 100644--- a/camel/toolkits/search_toolkit.py+++ b/camel/toolkits/search_toolkit.py@@ -267,7 +267,7 @@ class SearchToolkit(BaseToolkit):Country Codes. (default: :obj:`US `)search_lang (str): The search language preference.Use ONLY these exact values, NOT standard ISO codes:- 'ar', 'eu', 'bn', 'bg', 'ca', 'zh-hans', 'zh-hant', 'hr',+ 'ar', 'eu', 'bn', 'bg', 'ca', 'zh-hans', 'zh-hant', 'hr','cs', 'da', 'nl', 'en', 'en-gb', 'et', 'fi', 'fr', 'gl', 'de','gu', 'he', 'hi', 'hu', 'is', 'it', 'jp', 'kn', 'ko', 'lv','lt', 'ms', 'ml', 'mr', 'nb', 'pl', 'pt-br', 'pt-pt', 'pa',diff --git a/examples/toolkits/hybrid_browser_toolkit_example.py b/examples/toolkits/hybrid_browser_toolkit_example.pyindex eb5df7d62..48208c836 100644--- a/examples/toolkits/hybrid_browser_toolkit_example.py+++ b/examples/toolkits/hybrid_browser_toolkit_example.py@@ -81,7 +81,7 @@ output_dir = "./file_write_outputs"os.makedirs(output_dir, exist_ok=True)# Initialize the FileWriteToolkit with the output directory-file_toolkit = FileWriteToolkit(output_dir=output_dir)+file_toolkit = FileWriteToolkit(working_directory=output_dir)# Get the tools from the toolkittools_list = file_toolkit.get_tools()diff --git a/examples/workforce/eigent.py b/examples/workforce/eigent.pyindex 40b354510..ec81b184f 100644--- a/examples/workforce/eigent.py+++ b/examples/workforce/eigent.py@@ -212,7 +212,8 @@ def search_agent_factory(- **Analysis**: Use `get_som_screenshot` to understand the page layoutand identify interactive elements. Since this is a heavy operation,only use it when visual analysis is necessary.- - **Interaction**: Use `type` to fill out forms and `enter` to submit.+ - **Interaction**: Use `type` to fill out forms and `enter`+ to submit or confirm search.3. **Detailed Content Extraction**: Prioritize using the scraping toolsfrom `Crawl4AIToolkit` for in-depth information gathering from awebpage.@@ -666,13 +667,9 @@ async def main():human_task = Task(content=("""-Analyze the UK healthcare industry to support the planning of my next company.-Provide a comprehensive market overview, including current trends, growth-projections, and relevant regulations. Identify the top 5-10 major competitors-in the space, including their names, website URLs, estimated market size or-share, core services or products, key strengths, and notable weaknesses. Also-highlight any significant opportunities, gaps, or underserved segments within-the market. Present all findings in a well-structured, professional PDF report.+ go to amazon and find a popular product,+ check the comments and reviews,+ and then write a report about the product."""),id='0',