diff --git a/src/plugins/chat/utils.py b/src/plugins/chat/utils.py index bf834a380..f28d0e192 100644 --- a/src/plugins/chat/utils.py +++ b/src/plugins/chat/utils.py @@ -77,7 +77,7 @@ def calculate_information_content(text): return entropy -def get_cloest_chat_from_db(length: int, timestamp: str): +def get_closest_chat_from_db(length: int, timestamp: str): """从数据库中获取最接近指定时间戳的聊天记录 Args: diff --git a/src/plugins/memory_system/memory.py b/src/plugins/memory_system/memory.py index 4a8249504..f87f037d5 100644 --- a/src/plugins/memory_system/memory.py +++ b/src/plugins/memory_system/memory.py @@ -15,7 +15,7 @@ from ..chat.config import global_config from ..chat.utils import ( calculate_information_content, cosine_similarity, - get_cloest_chat_from_db, + get_closest_chat_from_db, text_to_vector, ) from ..models.utils_model import LLM_request @@ -190,19 +190,19 @@ class Hippocampus: # 短期:1h 中期:4h 长期:24h for _ in range(time_frequency.get('near')): random_time = current_timestamp - random.randint(1, 3600) - messages = get_cloest_chat_from_db(length=chat_size, timestamp=random_time) + messages = get_closest_chat_from_db(length=chat_size, timestamp=random_time) if messages: chat_samples.append(messages) for _ in range(time_frequency.get('mid')): random_time = current_timestamp - random.randint(3600, 3600 * 4) - messages = get_cloest_chat_from_db(length=chat_size, timestamp=random_time) + messages = get_closest_chat_from_db(length=chat_size, timestamp=random_time) if messages: chat_samples.append(messages) for _ in range(time_frequency.get('far')): random_time = current_timestamp - random.randint(3600 * 4, 3600 * 24) - messages = get_cloest_chat_from_db(length=chat_size, timestamp=random_time) + messages = get_closest_chat_from_db(length=chat_size, timestamp=random_time) if messages: chat_samples.append(messages) diff --git a/src/plugins/memory_system/memory_manual_build.py b/src/plugins/memory_system/memory_manual_build.py index e0d64b55f..2d16998e0 100644 --- a/src/plugins/memory_system/memory_manual_build.py +++ b/src/plugins/memory_system/memory_manual_build.py @@ -49,7 +49,7 @@ def calculate_information_content(text): return entropy -def get_cloest_chat_from_db(length: int, timestamp: str): +def get_closest_chat_from_db(length: int, timestamp: str): """从数据库中获取最接近指定时间戳的聊天记录,并记录读取次数 Returns: @@ -185,19 +185,19 @@ class Hippocampus: # 短期:1h 中期:4h 长期:24h for _ in range(time_frequency.get('near')): random_time = current_timestamp - random.randint(1, 3600*4) - messages = get_cloest_chat_from_db(length=chat_size, timestamp=random_time) + messages = get_closest_chat_from_db(length=chat_size, timestamp=random_time) if messages: chat_samples.append(messages) for _ in range(time_frequency.get('mid')): random_time = current_timestamp - random.randint(3600*4, 3600*24) - messages = get_cloest_chat_from_db(length=chat_size, timestamp=random_time) + messages = get_closest_chat_from_db(length=chat_size, timestamp=random_time) if messages: chat_samples.append(messages) for _ in range(time_frequency.get('far')): random_time = current_timestamp - random.randint(3600*24, 3600*24*7) - messages = get_cloest_chat_from_db(length=chat_size, timestamp=random_time) + messages = get_closest_chat_from_db(length=chat_size, timestamp=random_time) if messages: chat_samples.append(messages) diff --git a/src/plugins/memory_system/memory_test1.py b/src/plugins/memory_system/memory_test1.py index 2253d0032..245eb9b26 100644 --- a/src/plugins/memory_system/memory_test1.py +++ b/src/plugins/memory_system/memory_test1.py @@ -69,7 +69,7 @@ def calculate_information_content(text): return entropy -def get_cloest_chat_from_db(length: int, timestamp: str): +def get_closest_chat_from_db(length: int, timestamp: str): """从数据库中获取最接近指定时间戳的聊天记录,并记录读取次数 Returns: @@ -452,19 +452,19 @@ class Hippocampus: # 短期:1h 中期:4h 长期:24h for _ in range(time_frequency.get('near')): random_time = current_timestamp - random.randint(1, 3600*4) - messages = get_cloest_chat_from_db(length=chat_size, timestamp=random_time) + messages = get_closest_chat_from_db(length=chat_size, timestamp=random_time) if messages: chat_samples.append(messages) for _ in range(time_frequency.get('mid')): random_time = current_timestamp - random.randint(3600*4, 3600*24) - messages = get_cloest_chat_from_db(length=chat_size, timestamp=random_time) + messages = get_closest_chat_from_db(length=chat_size, timestamp=random_time) if messages: chat_samples.append(messages) for _ in range(time_frequency.get('far')): random_time = current_timestamp - random.randint(3600*24, 3600*24*7) - messages = get_cloest_chat_from_db(length=chat_size, timestamp=random_time) + messages = get_closest_chat_from_db(length=chat_size, timestamp=random_time) if messages: chat_samples.append(messages)