make the role aware of current time

This commit is contained in:
garylin2099 2024-08-28 22:03:51 +08:00
parent 400a1671ef
commit a63b7d2829

View file

@ -4,6 +4,7 @@ import inspect
import json
import re
import traceback
from datetime import datetime
from typing import Annotated, Callable, Dict, List, Literal, Optional, Tuple
from pydantic import Field, model_validator
@ -233,6 +234,10 @@ class RoleZero(Role):
msg.add_metadata(IMAGES, images)
return memory
def _get_prefix(self) -> str:
time_info = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
return super()._get_prefix() + f" The current time is {time_info}."
async def _act(self) -> Message:
if self.use_fixed_sop:
return await super()._act()