🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
update field definition of scratch
better629ab5ffacfb004
diff --git a/examples/st_game/actions/dummy_action.py b/examples/st_game/actions/dummy_action.pyindex 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 Actionfrom metagpt.schema import Message@@ -13,7 +11,6 @@ class DummyAction(Action):raise NotImplementedError-@dataclassclass DummyMessage(Message):"""dummy message to pass to role and make them to have a execution every rounddiff --git a/examples/st_game/memory/scratch.py b/examples/st_game/memory/scratch.pyindex 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, timedeltafrom pathlib import Path-from typing import Optional+from typing import Optional, Unionfrom 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")@classmethoddef check_time_filed(cls, time_filed):val = datetime.strptime(time_filed, "%B %d, %Y, %H:%M:%S") if time_filed else Nonediff --git a/examples/st_game/run_st_game.py b/examples/st_game/run_st_game.pyindex 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)))