typo
This commit is contained in:
@@ -77,7 +77,7 @@ def calculate_information_content(text):
|
|||||||
return entropy
|
return entropy
|
||||||
|
|
||||||
|
|
||||||
def get_cloest_chat_from_db(length: int, timestamp: str):
|
def get_closest_chat_from_db(length: int, timestamp: str):
|
||||||
"""从数据库中获取最接近指定时间戳的聊天记录
|
"""从数据库中获取最接近指定时间戳的聊天记录
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from ..chat.config import global_config
|
|||||||
from ..chat.utils import (
|
from ..chat.utils import (
|
||||||
calculate_information_content,
|
calculate_information_content,
|
||||||
cosine_similarity,
|
cosine_similarity,
|
||||||
get_cloest_chat_from_db,
|
get_closest_chat_from_db,
|
||||||
text_to_vector,
|
text_to_vector,
|
||||||
)
|
)
|
||||||
from ..models.utils_model import LLM_request
|
from ..models.utils_model import LLM_request
|
||||||
@@ -190,19 +190,19 @@ class Hippocampus:
|
|||||||
# 短期:1h 中期:4h 长期:24h
|
# 短期:1h 中期:4h 长期:24h
|
||||||
for _ in range(time_frequency.get('near')):
|
for _ in range(time_frequency.get('near')):
|
||||||
random_time = current_timestamp - random.randint(1, 3600)
|
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:
|
if messages:
|
||||||
chat_samples.append(messages)
|
chat_samples.append(messages)
|
||||||
|
|
||||||
for _ in range(time_frequency.get('mid')):
|
for _ in range(time_frequency.get('mid')):
|
||||||
random_time = current_timestamp - random.randint(3600, 3600 * 4)
|
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:
|
if messages:
|
||||||
chat_samples.append(messages)
|
chat_samples.append(messages)
|
||||||
|
|
||||||
for _ in range(time_frequency.get('far')):
|
for _ in range(time_frequency.get('far')):
|
||||||
random_time = current_timestamp - random.randint(3600 * 4, 3600 * 24)
|
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:
|
if messages:
|
||||||
chat_samples.append(messages)
|
chat_samples.append(messages)
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ def calculate_information_content(text):
|
|||||||
|
|
||||||
return entropy
|
return entropy
|
||||||
|
|
||||||
def get_cloest_chat_from_db(length: int, timestamp: str):
|
def get_closest_chat_from_db(length: int, timestamp: str):
|
||||||
"""从数据库中获取最接近指定时间戳的聊天记录,并记录读取次数
|
"""从数据库中获取最接近指定时间戳的聊天记录,并记录读取次数
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -185,19 +185,19 @@ class Hippocampus:
|
|||||||
# 短期:1h 中期:4h 长期:24h
|
# 短期:1h 中期:4h 长期:24h
|
||||||
for _ in range(time_frequency.get('near')):
|
for _ in range(time_frequency.get('near')):
|
||||||
random_time = current_timestamp - random.randint(1, 3600*4)
|
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:
|
if messages:
|
||||||
chat_samples.append(messages)
|
chat_samples.append(messages)
|
||||||
|
|
||||||
for _ in range(time_frequency.get('mid')):
|
for _ in range(time_frequency.get('mid')):
|
||||||
random_time = current_timestamp - random.randint(3600*4, 3600*24)
|
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:
|
if messages:
|
||||||
chat_samples.append(messages)
|
chat_samples.append(messages)
|
||||||
|
|
||||||
for _ in range(time_frequency.get('far')):
|
for _ in range(time_frequency.get('far')):
|
||||||
random_time = current_timestamp - random.randint(3600*24, 3600*24*7)
|
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:
|
if messages:
|
||||||
chat_samples.append(messages)
|
chat_samples.append(messages)
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ def calculate_information_content(text):
|
|||||||
|
|
||||||
return entropy
|
return entropy
|
||||||
|
|
||||||
def get_cloest_chat_from_db(length: int, timestamp: str):
|
def get_closest_chat_from_db(length: int, timestamp: str):
|
||||||
"""从数据库中获取最接近指定时间戳的聊天记录,并记录读取次数
|
"""从数据库中获取最接近指定时间戳的聊天记录,并记录读取次数
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -452,19 +452,19 @@ class Hippocampus:
|
|||||||
# 短期:1h 中期:4h 长期:24h
|
# 短期:1h 中期:4h 长期:24h
|
||||||
for _ in range(time_frequency.get('near')):
|
for _ in range(time_frequency.get('near')):
|
||||||
random_time = current_timestamp - random.randint(1, 3600*4)
|
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:
|
if messages:
|
||||||
chat_samples.append(messages)
|
chat_samples.append(messages)
|
||||||
|
|
||||||
for _ in range(time_frequency.get('mid')):
|
for _ in range(time_frequency.get('mid')):
|
||||||
random_time = current_timestamp - random.randint(3600*4, 3600*24)
|
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:
|
if messages:
|
||||||
chat_samples.append(messages)
|
chat_samples.append(messages)
|
||||||
|
|
||||||
for _ in range(time_frequency.get('far')):
|
for _ in range(time_frequency.get('far')):
|
||||||
random_time = current_timestamp - random.randint(3600*24, 3600*24*7)
|
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:
|
if messages:
|
||||||
chat_samples.append(messages)
|
chat_samples.append(messages)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user