放到40000 。

This commit is contained in:
liuwei
2025-05-28 12:30:18 +08:00
parent f7e3420212
commit 3c460ce4a7

View File

@@ -11,7 +11,7 @@ def compress_chat_data(chat_data_str, time_threshold=5):
:return: 压缩后的聊天数据的长字符串
"""
# 如果字符串长度超过30000则去除前面的聊天记录
if len(chat_data_str) > 30000:
if len(chat_data_str) > 40000:
lines = chat_data_str.splitlines()
total_length = 0
cut_index = 0
@@ -20,7 +20,7 @@ def compress_chat_data(chat_data_str, time_threshold=5):
for i in range(len(lines) - 1, -1, -1):
line_length = len(lines[i]) + 1 # +1 是为了计入换行符
total_length += line_length
if total_length > 30000:
if total_length > 40000:
cut_index = i + 1 # 保留这个索引之后的行
break