Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

update field definition of scratch

better6296dc752e94437
diff --git a/examples/st_game/actions/dummy_action.py b/examples/st_game/actions/dummy_action.py
index ba87d8516..a5004d5ef 100644
--- a/examples/st_game/actions/dummy_action.py
+++ b/examples/st_game/actions/dummy_action.py
@@ -2,8 +2,6 @@
# -*- coding: utf-8 -*-
# @Desc : dummy action to make every STRole can deal DummyMessage which is caused by DummyAction
-from dataclasses import dataclass
-
from metagpt.actions import Action
from metagpt.schema import Message
@@ -13,7 +11,6 @@ class DummyAction(Action):
raise NotImplementedError
-@dataclass
class DummyMessage(Message):
"""
dummy message to pass to role and make them to have a execution every round
diff --git a/examples/st_game/memory/scratch.py b/examples/st_game/memory/scratch.py
index b7040ce08..1c30f1829 100644
--- a/examples/st_game/memory/scratch.py
+++ b/examples/st_game/memory/scratch.py
@@ -4,7 +4,7 @@
from datetime import datetime, timedelta
from pathlib import Path
-from typing import Optional
+from typing import Optional, Union
from pydantic import (
BaseModel,
@@ -25,7 +25,7 @@ class Scratch(BaseModel):
# 类别2:世界信息
curr_time: Optional[datetime] = Field(default=None)
- curr_tile: Optional[str] = Field(default=None)
+ curr_tile: Optional[list[int]] = Field(default=None)
daily_plan_req: Optional[str] = Field(default=None)
# 类别3:人物角色的核心身份
@@ -59,8 +59,8 @@ class Scratch(BaseModel):
# 类别6:个人计划
daily_req: list[str] = Field(default=[])
- f_daily_schedule: list[list[str]] = Field(default=[])
- f_daily_schedule_hourly_org: list[list[str]] = Field(default=[])
+ f_daily_schedule: list[list[Union[int, str]]] = Field(default=[])
+ f_daily_schedule_hourly_org: list[list[Union[int, str]]] = Field(default=[])
# 类别7:当前动作
act_address: Optional[str] = Field(default=None)
@@ -90,7 +90,7 @@ class Scratch(BaseModel):
values["act_obj_event"] = (values["name"], None, None)
return values
- @field_validator("curr_time", "act_start_time", "chatting_end_time")
+ @field_validator("curr_time", "act_start_time", "chatting_end_time", mode="before")
@classmethod
def check_time_filed(cls, time_filed):
val = datetime.strptime(time_filed, "%B %d, %Y, %H:%M:%S") if time_filed else None
diff --git a/examples/st_game/run_st_game.py b/examples/st_game/run_st_game.py
index 523cfabaa..09ae8f0ec 100644
--- a/examples/st_game/run_st_game.py
+++ b/examples/st_game/run_st_game.py
@@ -24,6 +24,7 @@ async def startup(
):
town = StanfordTown()
logger.info("StanfordTown init environment")
+ print(f"{fork_sim_code}\t{sim_code}{temp_storage_path}\t{investment}\t{n_round}")
# copy `storage/{fork_sim_code}` to `storage/{sim_code}`
copy_folder(str(STORAGE_PATH.joinpath(fork_sim_code)), str(STORAGE_PATH.joinpath(sim_code)))