mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
recover code
This commit is contained in:
parent
08975c3a08
commit
08c4af29b5
2 changed files with 5 additions and 5 deletions
|
|
@ -158,7 +158,7 @@ class ExecuteNbCode(Action):
|
|||
else:
|
||||
cell["outputs"].append(new_output(output_type="stream", name="stdout", text=str(output)))
|
||||
|
||||
def parse_outputs(self, outputs: list[str], keep_len: int = 20000) -> Tuple[bool, str]:
|
||||
def parse_outputs(self, outputs: list[str], keep_len: int = 5000) -> Tuple[bool, str]:
|
||||
"""Parses the outputs received from notebook execution."""
|
||||
assert isinstance(outputs, list)
|
||||
parsed_output, is_success = [], True
|
||||
|
|
@ -191,8 +191,8 @@ class ExecuteNbCode(Action):
|
|||
output_text = remove_log_and_warning_lines(output_text)
|
||||
# The useful information of the exception is at the end,
|
||||
# the useful information of normal output is at the begining.
|
||||
# if '<!DOCTYPE html>' not in output_text:
|
||||
output_text = output_text[:keep_len] if is_success else output_text[-keep_len:]
|
||||
if '<!DOCTYPE html>' not in output_text:
|
||||
output_text = output_text[:keep_len] if is_success else output_text[-keep_len:]
|
||||
|
||||
parsed_output.append(output_text)
|
||||
return is_success, ",".join(parsed_output)
|
||||
|
|
|
|||
|
|
@ -197,9 +197,9 @@ class Browser:
|
|||
async def _on_frame_change(self, frame: Frame):
|
||||
await self._update_page_last_busy_time(frame.page)
|
||||
|
||||
async def view(self, keep_len: int = 10000):
|
||||
async def view(self):
|
||||
observation = parse_accessibility_tree(self.accessibility_tree)
|
||||
return f"Current Browser Viewer\n URL: {self.page.url}\nOBSERVATION:\n{observation[0][:keep_len]}\n"
|
||||
return f"Current Browser Viewer\n URL: {self.page.url}\nOBSERVATION:\n{observation[0]}\n"
|
||||
|
||||
async def __aenter__(self):
|
||||
await self.start()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue