Skip to content

Commit 8f67f66

Browse files
author
yunjiu
committed
[bugfix][memory] modified init_global_msg and update_msg_content_by_rule func
1 parent fde470a commit 8f67f66

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

muagent/connector/memory_manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ def tbasedoc2Memory(self, r_docs) -> Memory:
861861

862862

863863
def init_global_msg(self, chat_index: str, role_name: str, role_content: str, role_type: str = "global_value") -> bool:
864-
msg = Message(chat_index=chat_index, role_name=role_name, role_type=role_type, role_content=role_content)
864+
msg = Message(chat_index=chat_index, message_index = role_name ,role_name=role_name, role_type=role_type, role_content=role_content)
865865
try:
866866
self.append(msg)
867867
return True
@@ -889,14 +889,15 @@ def update_msg_content_by_rule(self, chat_index: str, role_name: str, new_conten
889889
if message == None:
890890
return False
891891

892-
prompt = f"{new_content}{message.role_content}{update_rule}"
892+
prompt = f"{new_content}\n{role_name}:{message.role_content}\n{update_rule}"
893893

894894
model = getChatModelFromConfig(self.llm_config)
895895

896896
new_role_content = model.predict(prompt)
897897

898898
if new_role_content is not None:
899899
message.role_content = new_role_content
900+
self.append(message)
900901
return True
901902
else:
902903
return False

0 commit comments

Comments
 (0)