mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-09 07:42:38 +02:00
add cr reporter
This commit is contained in:
parent
5c416a1f31
commit
d0486f8e11
3 changed files with 18 additions and 8 deletions
|
|
@ -131,7 +131,11 @@ class ResourceReporter(BaseModel):
|
|||
|
||||
def _format_data(self, value, name):
|
||||
data = self.model_dump(mode="json", exclude=("callback_url", "llm_stream"))
|
||||
data["value"] = str(value) if isinstance(value, Path) else value
|
||||
if isinstance(value, BaseModel):
|
||||
value = value.model_dump(mode="json")
|
||||
elif isinstance(value, Path):
|
||||
value = str(value)
|
||||
data["value"] = value
|
||||
data["name"] = name
|
||||
role = CURRENT_ROLE.get(None)
|
||||
if role:
|
||||
|
|
@ -263,7 +267,7 @@ class FileReporter(ResourceReporter):
|
|||
"""Report file resource synchronously."""
|
||||
return super().report(value, name)
|
||||
|
||||
async def async_report(self, value: Path, name: Literal["path", "meta", "content"] = "path"):
|
||||
async def async_report(self, value: Path, name: Literal["path", "meta", "content", "document"] = "path"):
|
||||
"""Report file resource asynchronously."""
|
||||
return await super().async_report(value, name)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue