strategy/kpl_api.py | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
strategy/kpl_api.py
@@ -388,8 +388,11 @@ # 清理多余数据函数 def check_and_remove_oldest_entry(self, max_entries): # 读取所有行并解析为 JSON 对象列表 if os.path.exists(self.file_path): with open(self.file_path, 'r', encoding='utf-8') as file: lines = [json.loads(line.strip()) for line in file if line.strip()] else: lines = [] # 如果行数超过限制,移除最早的一些行 if len(lines) >= max_entries: