From 4a39b40e727685e0b9eab41f064c6082b7624da2 Mon Sep 17 00:00:00 2001 From: yichuan520030910320 Date: Sun, 14 Sep 2025 02:37:30 -0700 Subject: [PATCH] ruff fix --- apps/history_data/history.py | 2 +- examples/dynamic_add_leann_no_recompute.py | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/history_data/history.py b/apps/history_data/history.py index bb2eac1..2af29e8 100644 --- a/apps/history_data/history.py +++ b/apps/history_data/history.py @@ -74,7 +74,7 @@ class ChromeHistoryReader(BaseReader): if count >= max_count and max_count > 0: break - last_visit, url, title, visit_count, typed_count, hidden = row + last_visit, url, title, visit_count, typed_count, _ = row # Create document content with metadata embedded in text doc_content = f""" diff --git a/examples/dynamic_add_leann_no_recompute.py b/examples/dynamic_add_leann_no_recompute.py index 27c6bb1..9e5a358 100644 --- a/examples/dynamic_add_leann_no_recompute.py +++ b/examples/dynamic_add_leann_no_recompute.py @@ -289,11 +289,8 @@ def add_incremental( embeddings = _np.ascontiguousarray(embeddings, dtype=_np.float32) # Append using FAISS-style signature (n, swig_ptr(x)); fall back to Python wrapper if needed - try: - index.add(embeddings.shape[0], hnsw_faiss.swig_ptr(embeddings)) - except TypeError: - # Some builds expose a Python-friendly signature: index.add(np.ndarray) - index.add(embeddings) + index.add(embeddings.shape[0], hnsw_faiss.swig_ptr(embeddings)) + hnsw_faiss.write_index(index, str(faiss_index_file)) print(f"Incremental add completed. Index updated at: {index_path}")