Add chat history limit for Agent and Role.

Fix bugs.
This commit is contained in:
Liu Zhicong
2023-09-27 10:09:31 -07:00
parent 594901df90
commit 5146bc1871
8 changed files with 25 additions and 19 deletions
+5
View File
@@ -13,6 +13,7 @@ class AIRole:
self.introduce : str = None
self.agent = None
self.enable_function_list : list[str] = None
self.history_len = 10
def load_from_config(self,config:dict) -> bool:
name_node = config.get("name")
@@ -39,6 +40,10 @@ class AIRole:
if intro_node is not None:
self.introduce = intro_node
history_node = config.get("history_len")
if history_node:
self.history_len = int(history_node)
if config.get("enable_function") is not None:
self.enable_function_list = config["enable_function"]