mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-09 07:42:38 +02:00
rm redundant
This commit is contained in:
parent
bec0f0d728
commit
3847e672b1
2 changed files with 0 additions and 15 deletions
|
|
@ -175,8 +175,6 @@ class ExecutePyCode(ExecuteCode, Action):
|
|||
outputs = self.parse_outputs(self.nb.cells[-1].outputs)
|
||||
success = True
|
||||
except Exception as e:
|
||||
# FIXME: CellExecutionError is hard to read. for example `1\0` raise ZeroDivisionError:
|
||||
# CellExecutionError('An error occurred while executing the following cell:\n------------------\nz=1/0\n------------------\n\n\n\x1b[0;31m---------------------------------------------------------------------------\x1b[0m\n\x1b[0;31mZeroDivisionError\x1b[0m Traceback (most recent call last)\nCell \x1b[0;32mIn[1], line 1\x1b[0m\n\x1b[0;32m----> 1\x1b[0m z\x1b[38;5;241m=\x1b[39m\x1b[38;5;241;43m1\x1b[39;49m\x1b[38;5;241;43m/\x1b[39;49m\x1b[38;5;241;43m0\x1b[39;49m\n\n\x1b[0;31mZeroDivisionError\x1b[0m: division by zero\n')
|
||||
outputs = traceback.format_exc()
|
||||
success = False
|
||||
return truncate(remove_escape_and_color_codes(outputs)), success
|
||||
|
|
|
|||
|
|
@ -7,19 +7,6 @@ from metagpt.utils.common import CodeParser
|
|||
from metagpt.logs import logger
|
||||
|
||||
|
||||
def truncate(result: str, keep_len: int = 2000) -> str:
|
||||
desc = "Truncated to show only the last keep_len characters\n"
|
||||
if result.startswith(desc):
|
||||
result = result[-len(desc) :]
|
||||
|
||||
if len(result) > keep_len:
|
||||
result = result[-keep_len:]
|
||||
|
||||
if not result.startswith(desc):
|
||||
return desc + result
|
||||
return desc
|
||||
|
||||
|
||||
class ReviewConst:
|
||||
TASK_REVIEW_TRIGGER = "task"
|
||||
CODE_REVIEW_TRIGGER = "code"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue