mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-29 15:59:42 +02:00
Merge branch 'add-web-scraping-test' into 'code_intepreter'
Add web scraping test See merge request agents/data_agents_opt!60
This commit is contained in:
commit
1fb77121f4
5 changed files with 51 additions and 3 deletions
|
|
@ -123,7 +123,10 @@ class ExecutePyCode(ExecuteCode, Action):
|
|||
return parsed_output
|
||||
|
||||
for i, output in enumerate(outputs):
|
||||
if output["output_type"] == "stream":
|
||||
if output["output_type"] == "stream" and not any(
|
||||
tag in output["text"]
|
||||
for tag in ["| INFO | metagpt", "| ERROR | metagpt", "| WARNING | metagpt"]
|
||||
):
|
||||
parsed_output += output["text"]
|
||||
elif output["output_type"] == "display_data":
|
||||
if "image/png" in output["data"]:
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class CodeInterpreter(Role):
|
|||
if ReviewConst.CHANGE_WORD[0] in review:
|
||||
counter = 0 # redo the task again with help of human suggestions
|
||||
|
||||
return code["code"] if code["language"] != "markdown" else "", result, success
|
||||
return code["code"] if code.get("language") != "markdown" else "", result, success
|
||||
|
||||
async def _write_code(self):
|
||||
todo = WriteCodeByGenerate() if not self.use_tools else WriteCodeWithTools(selected_tools=self.tools)
|
||||
|
|
|
|||
|
|
@ -19,4 +19,4 @@ async def scrape_web_playwright(url, *urls):
|
|||
web = await PlaywrightWrapper("chromium").run(url, *urls)
|
||||
|
||||
# Return the inner text content of the web page
|
||||
return {"inner_text": web.inner_text, "html": web.html}
|
||||
return {"inner_text": web.inner_text.strip(), "html": web.html.strip()}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue