From 3c460ce4a7fb778593a88954cdcbdb92e2d11728 Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 28 May 2025 12:30:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=BE=E5=88=B040000=20=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/compress_chat_data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/compress_chat_data.py b/utils/compress_chat_data.py index e6c5cc4..e2567f7 100644 --- a/utils/compress_chat_data.py +++ b/utils/compress_chat_data.py @@ -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